Reputation: 1424
I'm using this guide to build a small Go app:
https://codegangsta.gitbooks.io/building-web-apps-with-go/index.html
Folder structure looks like this:
go/src/fileserver/
main.go
fileserver.exe
public/
index.html
css/
bootstrap.min.css
The deployment instructions mention a "procfile" and a ".godir" file but it's a bit unclear what these are supposed to contain or where they are to be implemented. I'm not quite sure if my folder structure is correct either.
The error I'm getting is:
Failed to detect set buildpack https://github.com/kr/heroku-buildpack-go.git
Upvotes: 2
Views: 937
Reputation: 1677
Am going to be quoting the heroku documentation a lot.
Procfile
Define a Procfile
Use a Procfile, a text file in the root directory of your application, to explicitly declare what command should be executed to start your app. The Procfile in the example app you deployed looks like this:
web: go-getting-started
This declares a single process type, web, and the command needed to run it. The name web is important here. It declares that this process type will be attached to the HTTP routing stack of Heroku, and receive web traffic when deployed. The command used here, go-getting-started is the compiled binary of the getting started app. Procfiles can contain additional process types. For example, you might declare one for a background worker process that processes items off of a queue.
So in your example you would have a file named 'Procfile' in your root directory with contents being:
web: fileserver
.godir
The .godir
file is simply a file that simply specifies the root directory of your go project. This is useful when you say have a number of modules for a web app in different languages. So for example given a repo with the following tree.
github.com
└──someuser
└── somerepo
├── .godir
├── go_module
└── node_module
Where the contents of your .godir
file would be:
github.com/someuser/somerepo/go_module
A more verbose explanation of what .godir
is for and when it is used can be found here.
Upvotes: 2