{jenkins-plugin-info:golang}

Automatically installs and sets up the Go programming language (golang) tools for a build.

What it does

During a build, this plugin can:

Setup

Global configuration

  1. In the Jenkins global tool configuration settings (Manage Jenkins → Global Tool Configuration), find the "Go" section, click "Go Installations..." and "Add Go".
  2. Enter a name, e.g. "Go 1.8" — the name itself has no significance, but will be displayed to users during job configuration
  3. Either select "Install automatically" and select the desired Go version from the drop-down list or specify the installation directory manually

Per-job configuration

Freestyle

  1. In a job's configuration, find the "Build environment" section
  2. Select the "Set up Go programming language tools" checkbox
  3. Select the Go version you wish to be installed when this job is built

Pipeline

As with any other type of Tool Installer, you can use the tool step to install Go, using the go tool type. For example:

// Run on an agent where we want to use Go
node {
    // Install the desired Go version
    def root = tool name: 'Go 1.8', type: 'go'

    // Export environment variables pointing to the directory where Go was installed
    withEnv(["GOROOT=${root}", "PATH+GO=${root}/bin"]) {
        sh 'go version'
    }
}

Version history

Version 1.2 (February 25, 2017)

Version 1.1 (June 21, 2014)

Version 1.0 (June 18, 2014)