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

go-licenses doesn't work when installed with versioned go #193

Closed
heppu opened this issue Mar 9, 2023 · 3 comments
Closed

go-licenses doesn't work when installed with versioned go #193

heppu opened this issue Mar 9, 2023 · 3 comments

Comments

@heppu
Copy link

heppu commented Mar 9, 2023

When I use "versioned go binary" like instructed in https://go.dev/doc/manage-install go-licenses doesn't work.

Steps to produce:

go install golang.org/dl/go1.20.1@latest
go1.20.1 download
go1.20.1 install github.com/google/[email protected]
git clone https://github.com/google/go-licenses 
cd go-licenses
go1.20.1 mod download
go-licenses report github.com/google/go-licenses

This will produces just a list of errors and no license info:

E0309 15:49:30.676554   52440 library.go:117] Package context does not have module info. Non go modules projects are no longer supported. For feedback, refer to https://github.com/google/go-licenses/issues/128.
E0309 15:49:30.676605   52440 library.go:117] Package encoding/csv does not have module info. Non go modules projects are no longer supported. For feedback, refer to https://github.com/google/go-licenses/issues/128.
E0309 15:49:30.676613   52440 library.go:117] Package errors does not have module info. Non go modules projects are no longer supported. For feedback, refer to https://github.com/google/go-licenses/issues/128.
...

Env diff:

$ diff <(go env) <(go1.20.1 env)
19c19
< GOROOT="/usr/lib/go"
---
> GOROOT="/home/heppu/sdk/go1.20.1"
22c22
< GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
---
> GOTOOLDIR="/home/heppu/sdk/go1.20.1/pkg/tool/linux_amd64"
39c39
< GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1963812511=/tmp/go-build -gno-record-gcc-switches"
---
> GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3997467010=/tmp/go-build -gno-record-gcc-switches"

How ever using go run does seem to work:

$ go1.20.1 run github.com/google/go-licenses@latest report github.com/google/go-licenses
github.com/emirpasic/gods,https://github.com/emirpasic/gods/blob/v1.12.0/LICENSE,BSD-2-Clause
github.com/go-logr/logr,https://github.com/go-logr/logr/blob/v1.2.0/LICENSE,Apache-2.0
github.com/golang/groupcache/lru,https://github.com/golang/groupcache/blob/41bb18bfe9da/LICENSE,Apache-2.0
github.com/google/go-licenses,https://github.com/google/go-licenses/blob/HEAD/LICENSE,Apache-2.0
...
@Bobgy
Copy link
Collaborator

Bobgy commented Mar 9, 2023

The root cause seems to be #149 (comment)

@heppu
Copy link
Author

heppu commented Mar 9, 2023

Indeed doing:

GOROOT=$(go1.20.1 env GOROOT) go-licenses report github.com/google/go-licenses

does seem to fix issue.

@Bobgy
Copy link
Collaborator

Bobgy commented Mar 15, 2023

Duplicates #149 (comment)

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

2 participants