简体   繁体   English

Heroku上的Golang二进制文件

[英]Golang binary on Heroku

I've made a Golang application and I've no problem getting it to work on Heroku using the buildpack but now I would like to distribute the compiled program to others without the source code. 我已经制作了一个Golang应用程序,使用buildpack让它在Heroku上工作没有问题,但现在我想将编译好的程序分发给没有源代码的其他人。

Is it possible to get the binary working on Heroku without the source code or does Heroku need the source code to create its own compiled version? 是否有可能在没有源代码的情况下在Heroku上运行二进制文件,或者Heroku是否需要源代码来创建自己的编译版本?

The Heroku buildpack for Go doesn't do anything special: it just calls out to the Go tool to compile the binary based on whether you use godeps or not. GoHeroku buildpack没有做任何特别的事情:它只是调用Go工具来根据你是否使用godeps来编译二进制文件。

Just call go build in the directory of your package main or go build repo.com/you/yourmainpackage to output a binary you can distribute. 只需在你的package main目录中调用go build ,或者运行go build repo.com/you/yourmainpackage输出你可以分发的二进制文件。

In addition, you'll want to see this buildpack if you want to have others run a provided binary on Heroku : https://github.com/ph3nx/heroku-binary-buildpack — make sure the binary has been compiled for amd64 Linux if you are targeting Heroku. 另外,如果你想让其他人在Heroku上运行提供的二进制文件,你会想要看到这个buildpack: https//github.com/ph3nx/heroku-binary-buildpack - 确保已经为amd64 Linux编译了二进制文件如果你的目标是Heroku。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM