Go@0 - Go v0 タスク

このタスクは、Go アプリケーションの取得、ビルド、テスト、またはカスタム Go コマンドの実行に使用します。

構文

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

入力

command - コマンド
string. 必須です。 使用できる値: get、、buildtestcustom。 既定値: get

実行する Go コマンドを指定します。 ここに記載されていないコマンドを実行するには、 を使用 Custom します。


customCommand - カスタム コマンド
string. の場合は command == custom必須です。

実行するカスタム Go コマンド。 たとえば、 を実行 go versionするには、 を使用します version


arguments - 引数
string.

選択したコマンドの省略可能な引数。 たとえば、 コマンドにはビルド時引数を go build 使用します。


workingDirectory - 作業ディレクトリ
string.

コマンドを実行する作業ディレクトリ。 空の場合、リポジトリのルート (ビルドの場合) または成果物 (リリースの場合) が使用されます。これは の $(System.DefaultWorkingDirectory)値です。


タスク コントロール のオプション

すべてのタスクには、タスク入力に加えて制御オプションがあります。 詳細については、「 コントロール オプションと一般的なタスク プロパティ」を参照してください。

出力変数

[なし] :

解説

このタスクは、Go アプリケーションの取得、ビルド、テスト、またはカスタム Go コマンドの実行に使用します。

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()

要件

要件 説明
パイプラインの種類 YAML、クラシック ビルド、クラシック リリース
実行日 エージェント、DeploymentGroup
確認要求 なし
Capabilities このタスクは、ジョブ内の後続のタスクに対する要求を満たしていません。
コマンドの制限 Any
設定可能な変数 Any
エージェントのバージョン サポートされているすべてのエージェント バージョン。
タスクのカテゴリ Build