Notes on Golang projects.
NodeChef automatically detects your project as Golang if you do not explicitly specify if one of the below conditions is met.
- Your project has been packaged with godep using godep save.
- Your project has a vendor/ directory and has any files ending with .go.
- You have set the GOPACKAGENAME environment variable and your project has any files ending with .go. Note, if you are not using any vendering tool, you must set the environment variable GOPACKAGENAME for the deployment to work.
- Your project has a glide.yml file in the root folder.
- Your project has a Gopkg.toml file in the root folder.
- Your project has a go.mod file in the root folder and you are using the go mod init vendering tool.
Click here to see supported go versions
Start command.
Because Golang apps compile to a single file native binary, by default your project will be started with the build output as the command. You can override this behaviour by using a Procfile created in the root directory of your project. See example Procfile:
When Your Main Package is Not in the Project Root
A common project pattern is to place main packages in a subdirectory called cmd like in the example below:
In this case, you must set the environment variable GO_INSTALL_PACKAGE_SPEC. For example, if the module name for the project is github.com/superd/app-package-name, the value of the environment variable will be github.com/superd/app-package-name/cmd/server.