Public | Automated Build

Last pushed: 9 months ago
Short Description
This is a docker image to build Go projects and docker images, based on golang-builder
Full Description


This is a fork of golang-builder to better support BitBucket Pipelines.

This is a docker image to build Go projects and docker images. The container provides three scripts:

  •, which runs:
    • go vet
    • golint
    • errcheck
  •, which runs:
    • test with race detector
    • coverage reports
  •, which builds:
    • The binary
    • Docker image

Reports are generated into the buildreport/ directory.

It is heavily inspired by:CenturyLinkLabs golang-builder.

Full qualified package

To build the project with valid package references the Go builder needs to create the GOPATH with proper directories. Which directories
these are is not in the Go source code. Options are:

Canonical Import Path

Go allows you to define it via source code comment, for example:

package main // import ""

See Canonical import paths

Glide package

The glide dependency manager allows you to define the root package of your project in it's glide.yaml configuration file.



Same with Godeps. You can define the full qualified package name in the Godeps/Godeps.json file:

    "ImportPath": "",

Default path

An alternative would be to provide a default path which works for all your projects. See the

Dependency management

The would be a good start to look how things are currently implemented. Currently supported are:

  • gpm is used for dependency management. This doesn't give you reproducable builds and comes with
    other issues. Though a lot of our projects use it therefore I support it until all our projects are migrated.
  • Official Go vendoring
  • godep which does vendoring
  • glide

Build local

  • Run container to build binary and code metrics

    docker run --rm \
    -v $(pwd):/src \
  • Run container to build docker image, binary and code metrics

    docker run --rm \
    -v $(pwd):/src \
    -v /var/run/docker.sock:/var/run/docker.sock \
    mterring/golang-pipeline mytag

Other Resources

Docker Pull Command
Source Repository