donglian5309 2016-01-05 18: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 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.

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

报告相同问题?

悬赏问题

  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services