I have created an API using AWS SAM and Golang. This API is using an private module, both repos are present on codecommit. My buildspec.yml file is like this :
phases:
install:
commands:
- echo installing SAM ...
- pip install awscli aws-sam-cli
# Debugging
- go env | sort
- pwd
- find .
pre_build:
commands:
- echo Installing dependencies ...
# Fetch all dependencies
- go clean -modcache
- GOSUMDB=off go get git-codecommit.region.amazonaws.com/v1/repos/my-modules.git
- echo Installing dependencies done
- go get ./...
build:
commands:
- echo Build stated on `date`
- make
- sam deploy --template-file $PACKGED_TEMPLATE --stack-name $STACK_NAME --capabilities $CAPABILITY --s3-bucket $S3_BUCKET
post_build:
commands:
- echo Deployment completed on `date`
go env | sort result is:
GONOPROXY="git-codecommit.region.amazonaws.com/v1/repos/my-modules"
GONOSUMDB="git-codecommit.region.amazonaws.com/v1/repos/my-modules"
GOOS="linux"
GOPATH="/go:/codebuild/output/src161218396"
GOPRIVATE="git-codecommit.region.amazonaws.com/v1/repos/my-modules"
GOPROXY="https://proxy.golang.org,direct"
Build result is an error:
[Container] 2020/10/22 03:31:20 Running command GOSUMDB=off go get git-codecommit.region.amazonaws.com/v1/repos/my-modules.git
go: git-codecommit.region.amazonaws.com/v1/repos/[email protected]: reading git-codecommit.region.amazonaws.com/v1/repos/my-modules.git/go.mod at revision v1.0.0: unknown revision v1.0.0
[Container] 2020/10/22 03:31:23 Command did not exit successfully GOSUMDB=off go get git-codecommit.region.amazonaws.com/v1/repos/my-modules.git exit status 1
my-modules package is on codecommit and have tag v1.0.0
my-modules/go.mod
module git-codecommit.region.amazonaws.com/v1/repos/my-modules.git
go 1.15
require (
github.com/aws/aws-lambda-go v1.19.1
github.com/aws/aws-sdk-go v1.35.10
)
Not able to find out the reason for this problem. Looking for some help.