Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed setup description
Wiki Markup
{jenkins-plugin-info:golang}
Excerpt

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

What it does

During a build, this plugin can:

...

Global configuration

  1. In the Jenkins system global tool configuration settings (Manage Jenkins → Configure SystemGlobal Tool Configuration), find the "Go Installations" section and , 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. Choose Either select "Install automatically" and select the desired Go version of Go from the drop-down list or specify the installation directory manually

Per-job configuration

Freestyle

...

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

Code Block
java
java

// 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'
    }
}

...