简体   繁体   English

如何在Heroku上使用Go Web应用程序构建实用程序?

[英]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.

相关问题 如何在 vscode 中调试以 heroku 本地 web 开头的 go 应用程序 - How do I debug a go app started with heroku local web in vscode 如何关闭我的 heroku 应用程序? - How do i shutdown my heroku app? 如何将构建目录推送到Heroku? - How do I push my build directory to Heroku? 如何将我的 stripe webhook 发送到我的 Heroku 应用程序? - How do I send my stripe webhook to my Heroku app? 我已经使用 npm 运行构建命令并在 heroku 上部署了应用程序,现在如何编辑我的本地代码,然后将更改再次推送到 heroku? - I have used npm run build command and deployed app on heroku ,now how do I edit my local code and then push app again with the changes to heroku? 如何将我的 Squarespace 域指向我的 Heroku 应用程序? - How do I point my Squarespace domain to my Heroku app? 如何将heroku上的现有Web应用程序迁移到Rails? - How do I migrate an existing web app on heroku to rails? 如何准备 CRA 应用程序以部署到 heroku,我还需要像构建全栈 CRA 应用程序一样构建吗? - How do I prepare a CRA app to deploy to heroku, do I still have to build as for a fullstack CRA app? 我如何在Heroku上启动Play 2.1应用 - How do I get my Play 2.1 app started on Heroku 如何检查我的heroku应用正在使用哪个数据库? - How do I check which database my heroku app is using?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM