'Golang cross compile undefined errors

Probably something obvious, I'm building on OSX trying to build a Linux binary, this same command works on another project but:

GOOS=darwin GOARCH=amd64 go build -v gitlab.com/project/project-data-convertor

returns without error

GOOS=linux GOARCH=amd64 go build -v gitlab.com/project/project-data-convertor
gitlab.com/project/project-data-convertor
# gitlab.com/project/project-data-convertor
./utils.go:253:50: undefined: beamLocation
./utils.go:278:36: undefined: beamLocation
./utils.go:278:50: undefined: beamLocations
./utils.go:278:50: too many errors


Solution 1:[1]

I know it's a bit too late to answer this question but this problem came, on my side, from the import of C module. For those who have this problem of cross-platform compilation, check that you don't import C module : normally it should work.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Noste