Go@0 - Go v0 task

Use this task to get, build, or test a Go application, or to run a custom Go command.


# Go v0
# Get, build, or test a Go application, or run a custom Go command.
- task: Go@0
    command: 'get' # 'get' | 'build' | 'test' | 'custom'. Required. Command. Default: get.
    #customCommand: # string. Required when command == custom. Custom command. 
    #arguments: # string. Arguments. 
  # Advanced
    #workingDirectory: # string. Working directory.


command - Command
string. Required. Allowed values: get, build, test, custom. Default value: get.

Specifies a Go command to run. Use Custom to run a command not listed here.

customCommand - Custom command
string. Required when command == custom.

A custom Go command to execute. For example, to execute go version, use version.

arguments - Arguments

The optional arguments to the selected command. For example, use build-time arguments for the go build command.

workingDirectory - Working directory

The working directory where you want the command to run. When empty, the root of the repository (for builds) or artifacts (for releases) is used, which is the value of $(System.DefaultWorkingDirectory).

Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables



Use this task to get, build, or test a Go application, or to run a custom Go command.


  GOBIN:  '$(GOPATH)/bin' # Go binaries path
  GOROOT: '/usr/local/go1.11' # Go installation path
  GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path
  modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code

- task: GoTool@0
  displayName: 'Use Go 1.10'

- task: Go@0
  displayName: 'go get'
    arguments: '-d'

- task: Go@0
  displayName: 'go build'
    command: build
    arguments: '-o "$(System.TeamProject).exe"'

- task: ArchiveFiles@2
  displayName: 'Archive files'
    rootFolderOrFile: '$(Build.Repository.LocalPath)'
    includeRootFolder: False

- task: PublishBuildArtifacts@1
  displayName: 'Publish artifact'
  condition: succeededOrFailed()


Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version All supported agent versions.
Task category Build