This article is about Codeship Basic.

Go

You'll need roughly 2 minutes to read this article.

Versions And Setup

We have Go 1.4 installed by default in our virtual machine. To change to another Go version, use this script in your Setup Commands.

Path

We set the GOPATH to ${HOME} and checkout your code into

${HOME}/src/github.com/GITHUB_USER_NAME/GITHUB_REPOSITORY_NAME

Building Your Project

You can build your Go project with

go build

Dependencies

You can install dependencies with:

go get

To also install test dependencies, use the following command instead

go get -t -v ./...

Dependency Cache

We do not cache Go dependencies between builds.

Frameworks And Testing

We support all Go tools and test frameworks, sas long as they do not require root access for custom machine configuration. You can run your tests with a standard go test -v or by using test frameworks such as gocheck.

For example, using gocheck would look like:

go get launchpad.net/gocheck
go test -gocheck.v

Parallel Testing

If you are running parallel test pipelines, you will want separate your tests into groups and call a group specifically in each pipeline. For instance:

Pipeline 1:

go test tests_1.go

Pipeline 2:

go test tests_2.go

Parallelization Modules

In addition to parallelizing your tests explicitly via parallel pipelines, some customers have found using Go’s built-in test parallelization is a good way to speed up your tests.

Note that aggressive parallelization can cause resource and build failure issues, as well.

Notes And Known Issues

Due to Go version and build issues, you may find it helpful to tests your commands with different versions via an SSH debug session if tests are running differently on Codeship compared to your local machine.