This article is about Codeship Basic.

Using Go In CI/CD with Codeship Basic

Estimated Reading Time: 1 min

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.

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.

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

Parallelization

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.

Need More Help?

Get in touch if you need more help, or post on Stack Overflow using the tag #Codeship.

  • Ask The Helpdesk A Question
  • Code Examples And Sample Projects
    • Was This Article Helpful?