This document contains information related to projects based on the Ubuntu 14.04 image. If you are using the Ubuntu 18.04 image for your projects, please refer to this page.
If you are using the Ubuntu 14.04 image and you want to switch to Ubuntu 18.04, be sure to check our upgrade guide.
Setting up a Golang project on Semaphore is easy. The first time you add a Go project, Semaphore will analyze it and propose some frequently used build commands to speed up the setup process. If needed, these commands can be customized to better suit your needs.
The Semaphore platform supports the following Go versions:
Switching between different Go versions can be done in Project Settings or by adding the following command to your build commands:
Valid values for <version> are 1.4, 1.5, 1.6, 1.7, 1.8, 1.9 and 1.10.
To use change-go-version in a bash script, use the following command to load it:
#!/bin/sh source /opt/change-go-version.sh
The $GOPATH environment variable is set to /home/runner/workspace which contains the bin, pkg and src folders.
Your project's root directory is represented with a symlink in the src folder of $GOPATH.
Go project by default are configured to run:
go get -v -d ./… && go build -v ./…
The three dots (...) Go wildcard is used to expand to all package directories found in $GOPATH.
To achieve faster build times, we recommend caching your project's dependencies with godep.
Semaphore Docs are open source — Edit on GitHub