Heroku Golang - 找不到命令 'main'

标签 heroku go buildpack

我在 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/

相关文章:

json - 具有未知键的 Unmarshall JSON 上的空结构

ruby-on-rails - 为什么 Heroku 拒绝这个 git push?

javascript - Node.js 中的 NPM 错误

android - Twilio quick_start 项目不工作

python - 无法将 Heroku 数据库 pull 到本地

postgresql - 如何使用gorm从项目B中的go1.12 Flex实例连接到项目A中的GCP PostgreSQL 11 DB

amazon-web-services - 去 AWS 开发工具包 "Unable to determine service/operation name to be authorized"

linux - Heroku 构建包 : permission denied on npm install in bash script

python - Heroku 和 OpenCV 与 Python

spring - 调用 docker-compose build 命令时执行 Spring buildpacks