Artboard
Classic Docs
Docs Navigation

Go (Golang) Continuous Integration

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.

# CI environment for Go projects

The Semaphore platform supports the following Go versions:

  • 1.4.3
  • 1.5.4
  • 1.6.4
  • 1.7.6
  • 1.8.6
  • 1.9.7
  • 1.10.3
  • 1.11

Switching between different Go versions can be done in Project Settings or by adding the following command to your build commands:

change-go-version <version>

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.

# Dependency management

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

Newsletter

Occasional lightweight product and blog updates. Unsubscribe at any time.

2009-2020 © Rendered Text. All rights reserved. Terms of Service, Privacy policy, Security.