我一直在项目中使用mongo-driver,现在使用gcloud app deploy进行部署已有一段时间。我最近重建了机器,只需运行 go 以获取盟友。一切都在本地编译良好,但是 gcloud应用部署失败:
Failed to build app: building app with command '[go build -o /tmp/staging/usr/local/bin/start ***\admin]', env '[PATH=/go/bin:/usr/local/go/bin:/builder/google-cloud-sdk/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOSTNAME=***HOME=/builder/home BUILDER_OUTPUT=/builder/outputs DEBIAN_FRONTEND=noninteractive GOROOT=/usr/local/go/ GOPATH=/go GOPATH=/tmp/staging/srv/gopath]': err=exit status 1, out=srv/gopath/src/go.mongodb.org/mongo-driver/x/mongo/driver/compression_cgo.go:15:2: cannot find package "github.com/DataDog/zstd" in any of:
/tmp/staging/srv/gopath/src/go.mongodb.org/mongo-driver/vendor/github.com/DataDog/zstd (vendor tree)
/usr/local/go/src/github.com/DataDog/zstd (from $GOROOT)
/tmp/staging/srv/gopath/src/github.com/DataDog/zstd (from $GOPATH).
有什么想法吗? app.yaml只是运行时:go113
答案 0 :(得分:0)
您是否尝试过使用 go mod 指定依赖项? 我遇到了同样的问题,最后可以通过使用以下命令生成 go.mod 文件来解决,
GO111MODULE=on go mod init
GO111MODULE=on go mod tidy
Here是详细说明。