The default azure-pipelines.yml is broken

Copper Contributor

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/d62a4714-ede5-408d-9b1f-efbae06e65a3.sh
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:
# https://docs.microsoft.com/azure/devops/pipelines/languages/go

trigger:
- master

pool:
vmImage: ubuntu-latest

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:
- 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 https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
go build -v .
workingDirectory: '$(modulePath)'
displayName: 'Get dependencies, then build'

 

 

0 Replies