Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong GOROOT is used when go-licenses builds and runs on different environments #149

Open
jingyuanliang opened this issue Sep 14, 2022 · 6 comments

Comments

@jingyuanliang
Copy link
Contributor

jingyuanliang commented Sep 14, 2022

Unless a GOROOT is explicitly set, it uses the GOROOT from the build environment, which can be not reflecting the execution environment. See discussions in golang/go#51473.

@krutztq
Copy link

krutztq commented Oct 25, 2022

Same issue, here.

@Bobgy
Copy link
Collaborator

Bobgy commented Dec 7, 2022

As mentioned in the issue, a workaround is to set the GOROOT env when calling go licenses

radhus added a commit to einride/sage that referenced this issue Jan 4, 2023
Running go-licenses breaks after upgrading Go through Homebrew, as the
GOROOT path on the machine no longer matches the one used to build
go-licenses.

As a workaround, explicitly set GOROOT.

See google/go-licenses#149 for reference.
radhus added a commit to einride/sage that referenced this issue Jan 4, 2023
Running go-licenses breaks after upgrading Go through Homebrew, as the
GOROOT path on the machine no longer matches the one used to build
go-licenses.

As a workaround, explicitly set GOROOT.

See google/go-licenses#149 for reference.
radhus added a commit to einride/sage that referenced this issue Jan 4, 2023
Running go-licenses breaks after upgrading Go through Homebrew, as the
GOROOT path on the machine no longer matches the one used to build
go-licenses.

As a workaround, explicitly set GOROOT.

See google/go-licenses#149 for reference.
radhus added a commit to einride/sage that referenced this issue Jan 4, 2023
Running go-licenses breaks after upgrading Go through Homebrew, as the
GOROOT path on the machine no longer matches the one used to build
go-licenses.

As a workaround, explicitly set GOROOT.

See google/go-licenses#149 for reference.
@SuperSandro2000
Copy link

Are there any plans to fix this issue? 👀

@viceice
Copy link

viceice commented Jul 4, 2024

Can someone post a working sample? I've the same issue when having global go version go1.22.1 linux/amd64 and toolchain go1.22.5 in my go.mod

@SuperSandro2000
Copy link

You need to set GOROOT to your local running go compiler

@viceice
Copy link

viceice commented Jul 4, 2024

Found simple workaround:

> $(go env GOROOT)/bin/go run github.com/google/[email protected] save . --force --save_path=.go-licenses

dtrudg added a commit to dtrudg/singularity that referenced this issue Aug 27, 2024
If the go toolchain is downloaded due to installed version vs go.mod
then we need to set GOROOT for go-licenses to run correctly.

See: google/go-licenses#149
dtrudg added a commit to dtrudg/singularity that referenced this issue Aug 27, 2024
Pick sylabs#3265

If the go toolchain is downloaded due to installed version vs go.mod
then we need to set GOROOT for go-licenses to run correctly.

See: google/go-licenses#149
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants