Heroku的。 bash:apiworker:找不到命令

I'm following this Heroku/Go example https://github.com/heroku-examples/go_queue_example for a web and worker app.

Running the app via heroku local works but when deploying to Heroku I get the following command not found errors in the log:

2016-03-20T11:55:51.029091+00:00 heroku[worker.1]: Starting process with command `apiworker`
2016-03-20T11:55:51.603896+00:00 heroku[worker.1]: State changed from starting to up
2016-03-20T11:55:52.842882+00:00 app[worker.1]: bash: apiworker: command not found
2016-03-20T11:55:53.624937+00:00 heroku[worker.1]: Process exited with status 127
2016-03-20T11:55:53.634515+00:00 heroku[worker.1]: State changed from up to crashed
2016-03-20T11:58:56.772069+00:00 heroku[web.1]: State changed from crashed to starting
2016-03-20T11:58:56.986655+00:00 heroku[web.1]: Starting process with command `apiweb`
2016-03-20T11:58:58.389926+00:00 app[web.1]: bash: apiweb: command not found
2016-03-20T11:58:59.060779+00:00 heroku[web.1]: State changed from starting to crashed
2016-03-20T11:58:59.049447+00:00 heroku[web.1]: Process exited with status 127

The Procfile:

web: apiweb
worker: apiworker

The project structure:

.
├── Godeps
│   ├── Godeps.json
│   └── Readme
├── Procfile
├── cmd
│   ├── apiweb
│   │   └── main.go
│   └── apiworker
│       └── main.go
├── vendor
<snip>
└── api.go

Surprisingly, I've had little success with searching for answers in the documentation, here, and elsewhere. Any help would be greatly appreciated!

A bit late, but i had the same issue yesterday and what worked for me was re-saving the dependencies.

After moving your mains to cmd, you need to run $ godep save ./cmd/..., this of course then updates your Godeps.json file, but more importatnly it adds/updates the "Packages" field in the json, which in turn is used by heroku's buildpack (link) to run $ go install and $ godep go install (link).

Before I re-saved my dependencies the Godeps.json file did not have a "Packages" field and so the buildpack would run $ go install only in the project's root folder and not installing the sources in the cmd folder, which would then result in the command not found error.