plain-parrot-21984
03/24/2023, 10:30 AM_, err := apigatewayv2.NewApi(ctx, "example", &apigatewayv2.ApiArgs{
should be
_, err = apigatewayv2.NewApi(ctx, "example", &apigatewayv2.ApiArgs{
without the colon before the equals sign because the first variable is not defined
• https://www.pulumi.com/registry/packages/aws/api-docs/apigatewayv2/route/
_, err = apigatewayv2.NewRoute(ctx, "exampleRoute", &apigatewayv2.RouteArgs{
here it seems correct
This type of error, where _
is used as a placeholder (?) and the definition uses :=
seems to be very common.salmon-account-74572
03/24/2023, 8:33 PM_, err := blah
and then later _, err := otherblah
, it will flag the second one as incorrect (because you aren’t defining any new variables. That’s why you have to use _, err = otherblah
. I probably didn’t do a great job of explaining this, but hopefully it helps a little!echoing-dinner-19531
03/25/2023, 3:37 PM_, err = ...
is a compile error if the err
variable hasn't been declared elsewhere. _ err := ...
is a compile error if the err
variable is declared elsewhere. So our code generator has to change which one it uses based on if any other uses of err
have happened before.