MINGW-packages
MINGW-packages copied to clipboard
go: GOROOT is hardcoded (and wrong)
There is a variable, GOROOT, that specifies where go should look for its files. If not set in environment, go uses a hardcoded path defined at build-time (which for current binaries is C:\repo\mingw-w64-go\src\go
).
We need to define GOROOT in profile.d
(which is probably bad, because it's a mingw package) or patch the source, so go finds the path relatively to its executable.
Need more work on relocating go folders. Right now it not usable at all. It still look into ${GOROOT}/src
instead ${GOROOT}/lib/go/src
For reference: the Go Language manual Getting Started (doc/install) recommends never to install Go in other path than the installer suggests. Currently, BTW, GOROOT variable is always hardcoded into the binaries when Go is built. In Windows it's in pkg/windows_amd64/runtime/cgo.a
now.
$GOROOT
is widely used in every platform, while it's assumed to be hardcoded as the installer suggests. And it does not seem to change in the future. So I don't even think writing a patch is possible.
Despite not recommended by the language maintainers, it's enough to set $GOROOT
for equivalent of $MINGW_PREFIX/lib/go
; i.e. run GOROOT=/mingw64/lib/go go env
or GOROOT=$MINGW_PREFIX/lib/go go env
instead of go env
. So if possible, the package need to contain only one more line of setting GOROOT variable when installed.
@elieux Is this issue still reproducible?