google / go-licenses

A lightweight tool to report on the licenses used by a Go package and its dependencies. Highlight! Versioned external URL to licenses can be found at the same time.
Apache License 2.0
833 stars 125 forks source link

fix: segmentation fault panic when go modules info is missing #129

Closed Bobgy closed 2 years ago

Bobgy commented 2 years ago

Fixes https://github.com/google/go-licenses/issues/125

Bobgy commented 2 years ago

Verified the fix by deleting go.mod and go.sum in go-licenses folder and run the following command:

$ GO111MODULE=off go-licenses check .                            
E0412 01:10:39.958984   28063 library.go:103] Package _/home/gongyuan_kubeflow_org/github/google/go-licenses 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.
Error: some errors occurred when loading direct and transitive dependency packages

The current unit test setup cannot test this scenario.