संपादित करें

इसके माध्यम से साझा किया गया


Go@0 - Go v0 task

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

Syntax

# Go v0
# Get, build, or test a Go application, or run a custom Go command.
- task: Go@0
  inputs:
    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.

Inputs

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
string.

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


workingDirectory - Working directory
string.

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

None.

Remarks

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

Examples

variables:
  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

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

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

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

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

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

Requirements

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