Skip to content

make.bat: building on Windows fails if existing toolchain path contains space #57918

@kevpar

Description

@kevpar

What version of Go are you using (go version)?

> go version
go version go1.19.3 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
> go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\kevpar\AppData\Local\go-build
set GOENV=C:\Users\kevpar\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\kevpar\go\pkg\mod
set GOOS=windows
set GOPATH=C:\Users\kevpar\go
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.19.3
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\kevpar\src\go\src\go.mod
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\kevpar\AppData\Local\Temp\go-build2642396807=/tmp/go-build -gno-record-gcc-switches

What did you do?

  1. Installed Go on Windows via the standard installer, which installed it to "C:\Program Files\Go"
  2. Open the Go repo
  3. cd src
  4. .\make.bat

What did you expect to see?

The Go repo should successfully build.

What did you see instead?

>.\make.bat
ERROR: Cannot find C:\Users\kevpar\Go1.4\bin\go.exe
Set GOROOT_BOOTSTRAP to a working Go tree >= Go 1.17.13.

Details

This error occurs under the following conditions:

  • The path containing the existing go toolchain (output of where go) contains a space
  • GOROOT_BOOTSTRAP, which explicitly specifies the GOROOT to use when building, is unset

The error is caused because the output of where go is used without wrapping the path in spaces here.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.OS-Windows

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions