我在 Heroku 上获得了一个 Go API,我向其推送了一些代码;在我的 procfile 中,我有以下内容
web: main
为了在 Heroku 端启动 Go 构建的二进制文件。当我用
在我这边构建它时go build cmd/main.go
它在我的项目根目录中生成一个名为“main”的二进制文件并按预期工作,但在 Heroku 上我得到了
app[web.1]: bash: main: No such file or directory
Heroku 上的构建过程看起来不错,它找到我所有的依赖项并安装/编译它们。
最佳答案
一旦意识到这一点,这就 super 简单了;
All main packages in the repo are compiled and binaries placed in the /app/bin directory, which is in the PATH. Binaries are named after the directory that contains them.
关于Heroku Golang - 找不到命令 'main',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37696549/