Closed hunterwerlla closed 3 years ago
Can you try this (from https://github.com/aws/aws-sam-cli/pull/2646)?
go env -w GOFLAGS=-mod=mod
I could and I could also run go mod tidy
, but I expect it to work out of the box with no changes
This was fixed in https://github.com/aws/aws-sam-cli-app-templates/pull/99 and is now live.
Closing
Description:
Go 1.16 made changes to modules (see the section "No automatic changes to go.mod and go.sum" here https://blog.golang.org/go116-module-changes), specifically "Previously, when the go command found a problem with go.mod or go.sum like ... a missing sum, it would attempt to fix the problem automatically." Since this is no longer the case and the template does not have a go.sum by default (https://github.com/aws/aws-sam-cli-app-templates/tree/master/go1.x/cookiecutter-aws-sam-hello-golang/%7B%7Bcookiecutter.project_name%7D%7D/hello-world), sam build fails out of the box:
to fix this,
go mod download github.com/aws/aws-lambda-go
or similar command that creats a go.sum file must be run in the code directory (hello-world
out of the box)Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: AllAdd --debug flag to command you are running