[英]How do I build utilities with my Go web app on Heroku?
I've developed a web app using Go, which I've deployed to Heroku. 我使用Go开发了一个Web应用程序,并将其部署到Heroku。 I'm using mattes/migrate to manage migrations. 我正在使用遮罩/迁移来管理迁移。 It works great locally, but the migrate
command-line binary isn't available when I deploy to Heroku. 它在本地运行良好,但是当我部署到Heroku时, migrate
命令行二进制文件不可用。
The only binaries that are included are my own. 唯一包含的二进制文件是我自己的。 Is there a way to have Godeps compile and install binaries provided by a dependency? 有没有办法让Godeps编译并安装依赖项提供的二进制文件?
Just create a file where you include the executable path. 只需创建一个包含可执行文件路径的文件即可。
See this issue for Goose (mattes/migrate competitor) 请参阅有关鹅的问题 (哑光/迁移竞争对手)
I'd expect the equivalent for mattes/migrate would be: 我希望遮罩/迁移的等效项为:
package main
import _ "github.com/mattes/migrate"
Heroku's current recommended solution is to simply clone the command into your own repo (see github.com/tools/godep/issues/306). Heroku当前推荐的解决方案是将命令简单地克隆到您自己的存储库中(请参阅github.com/tools/godep/issues/306)。
I copied the mattes/migrate/main.go
into the cmd/migrate
directory in my own project. 我mattes/migrate/main.go
复制到了自己项目中的cmd/migrate
目录中。 This builds the command just like my own server command. 这就像我自己的服务器命令一样构建命令。
It's not ideal, but it works. 这不是理想的方法,但是可以。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.