Fix error finding 'Go'
-
Stop using
runtime.GOROOT
to find GoJust exec "go" directly. From the docs:
It uses the GOROOT environment variable, if set at process start, or else the root used during the Go build.
Since most environments I've seen don't set
GOROOT
the value is taken from build time, this causes issues when:- Go isn't rooted on your system in the same place as on my system
- You build and run this application under different versions of Go and
GOROOT
is set depending on the version, e.g./opt/hostedtoolcache/go/1.22.0
-
Simplify
testadata
setupMove
testdata
closer to where it's tested and remove unnecessary path finding logic since, per the docs[1]:When 'go test' runs a test binary, it does so from within the corresponding package's source code directory.
So we can just find
testdata
relative to where the tests are being run.