The default azure-pipelines.yml is broken

Occasional Visitor

Create a new project.  Create an azure repo and clone it with ssh.

Run go mod init and create a main.go file in the cloned repo.  Commit and push the changes.

Create a pipeline using your repo.  An azure-pipelines.yml is created as shown below.

Run the new pipeline.  It gives the error below.


My go.mod has go 1.19 and if I change the .yml to 1.19 it gives the same error with /usr/local/go1.19.


How do I fix this, and where do I file a bug against the Pipeline default .yml file?



2022-11-01T03:06:15.6247802Z [command]/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/
2022-11-01T03:06:15.6248305Z go: cannot find GOROOT directory: /usr/local/go1.11
2022-11-01T03:06:15.6248734Z go: cannot find GOROOT directory: /usr/local/go1.11
2022-11-01T03:06:15.6249112Z go: cannot find GOROOT directory: /usr/local/go1.11
2022-11-01T03:06:15.6282871Z ##[error]Bash exited with code '2'.


Here is the .yml:


# Go
# Build your Go project.
# Add steps that test, save build artifacts, deploy, and more:

- master

vmImage: ubuntu-latest

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

- script: |
mkdir -p '$(GOBIN)'
mkdir -p '$(GOPATH)/pkg'
mkdir -p '$(modulePath)'
shopt -s extglob
shopt -s dotglob
mv !(gopath) '$(modulePath)'
echo '##vso[task.prependpath]$(GOBIN)'
echo '##vso[task.prependpath]$(GOROOT)/bin'
displayName: 'Set up the Go workspace'

- script: |
go version
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl | sh
dep ensure
go build -v .
workingDirectory: '$(modulePath)'
displayName: 'Get dependencies, then build'



0 Replies