donglian5309 2016-01-05 10:53
浏览 89
已采纳

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

What would be the proper way to deploy a Go app to Azure that have private GitHub repositories as dependencies? Here's the current error from 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)

I was previously deploying via FTP with web.config's HttpPlatformHandler entry. But using git push is quicker especially for non-Windows team members.

Thanks

  • 写回答

1条回答 默认 最新

  • duanmeng3476 2016-01-07 02:22
    关注

    As @Not_a_Golfer and @Xiaomin said, vendoring the dependencies worked, here's what I did:

    1. Turned the env variable on locally GO15VENDOREXPERIMENT=1
    2. Installed godep => go get github.com/tools/godep
    3. Making sure your app is passing a go build & go test
    4. Ran godep save this copied all dependencies to ./vendor
    5. On my Azure web app, I also set the environment variable GO15VENDOREXPERIMENT=1
    6. git pushed and voila.

    At first I did not set the environment variable on my Azure app, so the dependency resolver was not looking in ./vendor, turning it to 1 fixed everything.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部