Manage Go dependencies with godep
This tutorial explains how to deploy a Go application which is using godep
to manage its dependencies. To handle the version management of the
dependencies, please follow the offical godep
guide, this page will focus on the
deployment of the app.
Configuration
During the deployment of a godep-ed application, we’re looking at different special
keys in the configuration file Godeps/Godeps.json
to give our deployment system the
data we need to deploy correctly the application:
-
GoVersion
(String): the version of Go you would like Scalingo to use when compiling your code. If not specified, we’ll install the last stable version. -
Packages
(Array of strings): What should be installed of your application. We’ll default to["."]
to install the package at the top level of your project, if your executable is in thecmd
directory, another common choice is["./cmd/..."]
. If you want to install all the packages including those which are vendored, you can use["./..."]
. -
ImportPath
(String): Name of the package installed during the deployment. If noPackages
are present, the binary will have the name of the last part of the complete package name:github.com/Scalingo/sample-go-martini
will create a binary namedsample-go-martini
.
Here is an example with godep
: https://github.com/Scalingo/sample-go-martini.
{
...
"ImportPath": "github.com/Scalingo/sample-go-martini"
"GoVersion": "go1.10",
"Packages": ["."],
...
}