You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not expected when using modern versions of Go. The GitHub Actions task has it right:
// Go versions less than 1.9 require GOROOT to be setif(semver.lt(version,'1.9.0')){core.info('Setting GOROOT for Go version < 1.9');core.exportVariable('GOROOT',installDir);}
The problem with hardcoding a GOROOT is that if any other go tool is in use (for example, because one compiled Go tip), the environment variable will override its autodetected GOROOT. The result is that the GOROOT and the go binary will mismatch, leading to obscure errors.
Specific example: when we try to call the Go tip's go tool dist test, Go complains that "dist" doesn't exist, because it's looking in the wrong GOROOT. dist doesn't exist for the preinstalled Go, but it does exist in the just-compiled Go tip.
As a workaround, explicitly unsetting GOROOT in our CI that uses this setup task fixes go tool dist test for a Go tip build.
Environment type (Please select at least one enviroment where you face this issue)
Self-Hosted
Microsoft Hosted
VMSS Pool
Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
macOS
Relevant log output
##[debug]Go tool is cached under /Users/runner/hostedtoolcache/go/1.23.3/x64##[debug]set GOROOT=/Users/runner/hostedtoolcache/go/1.23.3/x64##[debug]Processed: ##vso[task.setvariable variable=GOROOT;isOutput=false;issecret=false;]/Users/runner/hostedtoolcache/go/1.23.3/x64
Full task logs with system.debug enabled
No response
Repro steps
The text was updated successfully, but these errors were encountered:
New issue checklist
Task name
GoTool@0
Task version
0.246.3
Issue Description
The task sets GOROOT:
https://dev.azure.com/dnceng-public/public/_build/results?buildId=924196&view=logs&j=7fa8201e-1424-5163-cc6b-2afca1adf7af&t=e432957b-2dfa-524d-050f-31437c5f2997&l=92
This is not expected when using modern versions of Go. The GitHub Actions task has it right:
This repo appears to set it unconditionally:
azure-pipelines-tasks/Tasks/GoToolV0/gotool.ts
Lines 107 to 110 in a5d47e2
Originally I thought this was an issue with the agent and filed an issue, but now I've realized the issue is this setup task:
The reason it's not just unnecessary but potentially harmful to set GOROOT is menitoned in actions/runner-images#2655 and actions/runner-images#11331:
Specific example: when we try to call the Go tip's
go tool dist test
, Go complains that "dist" doesn't exist, because it's looking in the wrong GOROOT.dist
doesn't exist for the preinstalled Go, but it does exist in the just-compiled Go tip.As a workaround, explicitly unsetting GOROOT in our CI that uses this setup task fixes
go tool dist test
for a Go tip build.Environment type (Please select at least one enviroment where you face this issue)
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
macOS
Relevant log output
Full task logs with system.debug enabled
No response
Repro steps
The text was updated successfully, but these errors were encountered: