如何通过 git 推送将私有存储库作为依赖项来部署 Azure Go Web 应用程序?

How to deploy an Azure Go web app via git push with private repositories as dependencies?

将私有 GitHub 存储库作为依赖项的 Go 应用程序部署到 Azure 的正确方法是什么?这是 Kudu 的当前错误:

Resolving dependencies
# cd .; git clone https://github.com/my/privaterepo
  D:\local\Tempd315fa89272e69\gopath\src\github.com\my\privaterepo
Cloning into 'D:\local\Tempd315fa89272e69\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.5.1\src\github.com\my\privaterepo\pkg1 (from $GOROOT)

我之前使用 web.config 的 HttpPlatformHandler 条目通过 FTP 进行部署。但是使用 git 推送更快,尤其是对于非 Windows 团队成员。

谢谢

正如@Not_a_Golfer 和@Xiaomin 所说,出售依赖项是有效的,我是这样做的:

  1. 在本地打开环境变量GO15VENDOREXPERIMENT=1
  2. 已安装 godep => go get github.com/tools/godep
  3. 确保您的应用通过 go build & go test
  4. 运行 godep save 这将所有依赖项复制到 ./vendor
  5. 在我的 Azure Web 应用程序上,我还设置了环境变量 GO15VENDOREXPERIMENT=1
  6. git 推了,瞧。

起初我没有在我的 Azure 应用程序上设置环境变量,所以依赖项解析器没有在 ./vendor 中查找,将其设置为 1 修复了所有问题。