sage icon indicating copy to clipboard operation
sage copied to clipboard

fix: remove GOROOT from go-licenses

Open fredrikaverpil opened this issue 1 year ago • 3 comments

Why?

In #639 I noticed a gopls warning:

[go-pls] Linting Go files with gopls...
[go-pls] 
/Users/fredrik/code/work/public/sage/tools/sggolicenses/tools.go:56:53-67: runtime.GOROOT is deprecated: The root used during the Go build will not be meaningful if the binary is copied to another machine. Use the system path t
o locate the “go” binary, and use “go env GOROOT” to find its GOROOT.
/Users/fredrik/code/work/public/sage/tools/sggolicenses/tools.go:100:54-68: runtime.GOROOT is deprecated: The root used during the Go build will not be meaningful if the binary is copied to another machine. Use the system path 
to locate the “go” binary, and use “go env GOROOT” to find its GOROOT.

What?

I removed the line setting the GOROOT env var.

Notes

@alethenorio I believe you originally wrote this?

https://github.com/einride/sage/blob/ea6326b1a84a8551b58b380d000c56bb37496cf0/tools/sggolicenses/tools.go#L47-L56

Please have a look :smile:

fredrikaverpil avatar Feb 17 '25 10:02 fredrikaverpil

#369 is the source of that addition, and the go-licenses issue is still open. If you can test with e.g. a go-licenses built with Go <1.x and have Go >1.x installed then that would be nice 😄

Or we just revert like this and let users complain if go-licenses start to error again!

radhus avatar Feb 17 '25 11:02 radhus

GOROOT was deprecated in Go 1.24 so I don't think we should remove it just yet until we migrate Sage to ir

alethenorio avatar Feb 17 '25 11:02 alethenorio

I guess we can close this for now or put it into draft for later.

fredrikaverpil avatar Feb 17 '25 12:02 fredrikaverpil

This PR has been open for 180 days with no activity. Remove the stale label or add a comment or it will be closed in 14 days.

github-actions[bot] avatar Aug 18 '25 08:08 github-actions[bot]