Updated on 2026-01-08 GMT+08:00

Using Go for Build

In this action, you build a Go project.

Prerequisites

The project is developed using the Go language, and the build description file exists in the code.

Graphical Build

Add Build with Go, when configuring build actions.

The parameters are described in the following table.

Parameter

Description

Action Name

Name of a build action. It can be customized.

Tool Version

Select a tool version. The recommended version has been selected by default. You can select the Go version that matches your build environment.

Commands

Configure the Go project build commands. You can also use default commands. If you have special build requirements, enter your custom build script in the text box.

Code-based Build

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
version: 2.0 # The value must be 2.0.
steps:
  BUILD:
    - go: 
        inputs: 
          command: |
            export GO15VENDOREXPERIMENT=1 
            export GOPROXY=https://goproxy.cn 
            mkdir -p $GOPATH/src/example.com/demo/ 
            cp -rf . $GOPATH/src/example.com/demo/ 
            go install example.com/demo 
            cp -rf $GOPATH/bin/ ./bin

Parameter

Type

Description

Mandatory

Default Value

command

String

Commands to be run.

Yes

None