go - 如何在 Google Cloud Functions with Go 中使用 vendor 的本地存储库

标签 go google-cloud-functions go-modules

我正在尝试部署一个用 Go 编写的 Google Cloud Function。

通过做一些研究,我发现 vendor 文件比 go.mod 更受欢迎,所以我出售我使用的所有东西(包括一些本地依赖项)并忽略 .gcloudignore 文件中的 go.mod/sum 文件。

问题是尝试部署后,我收到以下错误:

go: nimbus@v0.0.0-00010101000000-000000000000: parsing /nimbus/go.mod: open /nimbus/go.mod: no such file or directory; Error ID: 03a1e2f7

nimbus 是我的本地依赖,它具有以下结构:

local repository structure

我的函数存储库具有以下结构:

enter image description here

我的 go.mod 文件是:
module my_function

go 1.13

require nimbus v0.0.0-00010101000000-000000000000

replace nimbus => ../../../nimbus

我试过这个解决方案https://stackoverflow.com/questions/5441096已经。但这并没有解决我的问题。

我已经尝试了一切来解决这个问题,但似乎没有任何效果。

最佳答案

If you have a go.mod file and a vendor directory, the vendor directory will be ignored when you deploy your function.



https://cloud.google.com/functions/docs/writing/specifying-dependencies-go

我在 Go 中部署 GCP 功能时使用了模块。没有遇到任何问题。但我不能说使用 vendor/的偏好。它应该可以工作,只是没有 go.mod 文件。

关于go - 如何在 Google Cloud Functions with Go 中使用 vendor 的本地存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62050011/

相关文章:

go - 如何使用反射将值设置为包含 nil 的指针

python - 当python服务器通过gRPC获取数据时,如何解决格式错误的字符串输出?

Node.js 应用程序无法在 Cloud Functions for Firebase 中渲染 hbs

docker - 如何在 Docker 容器中保留 go 1.11 模块?

go - 导入本地源文件以兼容 Travis CI

windows - 如何使用 go 在 Windows 控制台中正确输出字符串?

typescript - Firebase CLI 部署警告 : The Node. js 8 运行时已弃用,将于 2020-12-05 停用

firebase - 在服务器/管理员上创建帐户后发送 Firebase 重置密码电子邮件

go get -u github.com/onsi/ginkgo/ginkgo 突然开始抛出错误