我正在尝试使用 bitbucket 管道和 AWS Elastic Beanstalk 部署基于 gin 框架的 golang 应用程序。我创建了我的包 application.zip,其中包含在 EB 内部署应用程序所需的所有文件,当我通过管道或 AWS 控制台中的手动菜单推送它时,我得到了这些:
17:21:49 make.1 | go: finding github.com/appleboy/gin-jwt v2.5.0+incompatible
17:21:49 make.1 | go: downloading github.com/appleboy/gin-jwt v2.5.0+incompatible
17:21:49 make.1 | go: extracting github.com/appleboy/gin-jwt v2.5.0+incompatible
17:21:50 make.1 | go: finding gopkg.in/dgrijalva/jwt-go.v3 v3.2.0
17:21:50 make.1 | go: downloading gopkg.in/dgrijalva/jwt-go.v3 v3.2.0
17:21:50 make.1 | go: extracting gopkg.in/dgrijalva/jwt-go.v3 v3.2.0
17:21:50 make.1 | + GOOS=linux
17:21:50 make.1 | + GOARCH=amd64
17:21:50 make.1 | + go build -o bin/application '-ldflags=-s -w'
17:21:50 make.1 | go: cannot find main module; see 'go help modules'
17:21:50 make.1 | exited with code 1
17:21:50 system | sending SIGTERM to all processes
我发现我忘记了 go.mod 文件,确实添加了它,然后我收到了这些消息,一切都很好:
17:27:59 make.1 | go: extracting github.com/appleboy/gin-jwt v2.5.0+incompatible
17:27:59 make.1 | go: downloading gopkg.in/dgrijalva/jwt-go.v3 v3.2.0
17:27:59 make.1 | go: extracting gopkg.in/dgrijalva/jwt-go.v3 v3.2.0
17:27:59 make.1 | go: finding gopkg.in/dgrijalva/jwt-go.v3 v3.2.0
17:27:59 make.1 | + GOOS=linux
17:27:59 make.1 | + GOARCH=amd64
17:27:59 make.1 | + go build -o bin/application '-ldflags=-s -w'
17:27:59 make.1 | go: downloading golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c
17:28:00 make.1 | go: extracting golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c
17:28:00 make.1 | go: finding golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c
17:28:01 make.1 | exited with code 0
17:28:01 system | sending SIGTERM to all processes
现在我不知道$GOPATH/go.mod 是否存在,但我不应该使用最新的 Go 版本 1.13.4,而 AWS 使用 1.13.2。
一只萌萌小番薯
元芳怎么了
陪伴而非守候
摇曳的蔷薇
相关分类