donglian5309
2016-01-05 18:53
浏览 79
已采纳

如何通过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

图片转代码服务由CSDN问答提供 功能建议

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

 解析依赖项
#cd。  git clone https://github.com/my/privaterepo
 D:\ local \ Temp \ 8d315fa89272e69 \ gopath \ src \ github.com \ my \ privaterepo 
克隆到'D:\ local \ Temp \ 8d315fa89272e69 \ gopath \  src \ github.com \ my \ privaterepo'... 
fatal:无法读取“ https://github.com”的用户名:错误的文件描述符
package github.com/my/privaterepo/pkg1:退出状态128 \  npackage github.com/my/privaterepo/pkg2:找不到软件包$ GOROOT)
 
正在构建Go应用以生成exe文件
azureapp \ file.go:8:2:找不到软件包“ github.com/my/privaterepo/  pkg1“ 
中的任何一个:
 D:\ Program Files \ Go \ 1.5.1 \ src \ github.com \ my \ privaterepo \ pkg1(来自$ GOROOT)
   
 \  n 

我以前曾通过FTP使用 web.config 的HttpPlatformHandler条目进行部署。 但是使用git push更快,特别是对于非Windows团队成员。

谢谢

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanmeng3476 2016-01-07 10: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.

    打赏 评论

相关推荐 更多相似问题