将 Go 应用程序部署到以私有(private) GitHub 存储库作为依赖项的 Azure 的正确方法是什么?这是 Kudu 的当前错误:
Resolving dependencies
# cd .; git clone https://github.com/my/privaterepo
D:\local\Temp\8d315fa89272e69\gopath\src\github.com\my\privaterepo
Cloning into 'D:\local\Temp\8d315fa89272e69\gopath\src\github.com\my\privaterepo'...
fatal: could not read Username for 'https://github.com': Bad file descriptor
package github.com/my/privaterepo/pkg1: exit status 128
package github.com/my/privaterepo/pkg2: cannot find package $GOROOT)
Building Go app to produce exe file
azureapp\file.go:8:2: cannot find package "github.com/my/privaterepo/pkg1"
in any of:
D:\Program Files\Go\1.5.1\src\github.com\my\privaterepo\pkg1 (from $GOROOT)
我之前使用 web.config
的 HttpPlatformHandler 条目通过 FTP 进行部署。但使用 git Push 速度更快,尤其是对于非 Windows 团队成员。
谢谢
最佳答案
正如 @Not_a_Golfer 和 @Xiaomin 所说,供应依赖项是有效的,这就是我所做的:
- 在本地打开环境变量
GO15VENDOREXPERIMENT=1
- 已安装
godep
=>转到github.com/tools/godep
- 确保您的应用通过
go build
和go test
- Ran
godep save
这将所有依赖项复制到 ./vendor - 在我的 Azure Web 应用中,我还设置了环境变量
GO15VENDOREXPERIMENT=1
- git 推送了,瞧。
起初,我没有在 Azure 应用程序上设置环境变量,因此依赖项解析器没有在 ./vendor 中查找,将其设置为 1 修复了所有问题。
关于azure - 如何使用私有(private)存储库作为依赖项通过 git Push 部署 Azure Go Web 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34619209/