techknowlogick / xgo

Go CGO cross compiler
MIT License
478 stars 79 forks source link

Adjust go111modules detection and fix lint #180

Closed zeripath closed 2 years ago

zeripath commented 2 years ago

Go changed the way GO111MODULES is interpreted in 1.17+ and therefore xgo needs to recognise this change of behaviour.

Now, we could use the GO_VERSION environment variable but it's not really well defined as the build.sh script has apparently different interpretations within it. Thus this PR actually drops to parsing the result of go version to get the MAJOR and the MINOR version number out. The tests that use GO_VERSION are then changed to heed the results of these and the GO111MODULES behaviour is changed to match that.

Finally there were a number of issues detected with shellcheck in the scripts and this PR fixes the lint for these too.

(This PR could be split in two if necessary to helpfully separate the linting issues from the other fixes.)

Fix #179