Since around early September 2024, I’ve had an issue with builds of a Go language project on Windows. Windows builds for the project were working well for years before. The Windows build fails even when no code changes are made when compared to a previously passing build.
The builds fail with an error during the travis_setup_go step, and time out. The line erroring is an export of the PATH variable:
The command "export PATH=/bin:/c/Users/travis/gopath/bin:/c/Users/travis/bin:/bin:/usr/bin:/c/tools/ruby27/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/ProgramData/GooGet:/c/Program Files/Google/Compute Engine/metadata_scripts:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/Program Files/Google/Compute Engine/sysprep:/c/Program Files/Docker:/c/ProgramData/chocolatey/bin:/c/Program Files/CMake/bin:/c/Program Files/Git/cmd:/c/Program Files/LLVM/bin:/c/Program Files/dotnet:/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit:/c/tools/BCURRAN3:/c/Users/travis/AppData/Local/Microsoft/WindowsApps:/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin" failed and exited with 1 during .
For the Travis CI team, here is an example of a passing build:
os: windows
language: go
go:
- "1.20" # or whatever version you need
before_install:
- go version || echo "Go is not installed"
- choco install golang -y # Ensures Go is installed on Windows
- export PATH="/c/Go/bin:$PATH"
- export GOPATH="/c/Users/travis/gopath"
- echo "GOPATH: $GOPATH"
- echo "PATH: $PATH"
- go version
install:
- go mod tidy
script:
- go build ./...
- go test ./...