wails: Cross compilation using xgo does not copy local (unpublished) packages
Description
I’ve been trying to cross compile for windows from my Linux machine and ran into an issue. I have a go module in a different directory than the one in which my wails project is located—I import this module in a go.mod file in my wails project directory using the replace keyword. When I try to compile, I get the following message:
Compiling for windows-4.0/amd64...
go: github.com/username/projectname/client@v0.0.0-00010101000000-000000000000: parsing /home/dk/go/src/github.com/username/projectname/client/go.mod: open /home/dk/go/src/github.com/username/projectname/client/go.mod: no such file or directory
I suspect that the output is from the Docker container, and that the necessary files are not being copied in.
To Reproduce Steps to reproduce the behaviour:
- Import a local go module outside the immediate project directory using go modules’
replacekeyword from within the go.mod of your wails project directory. - Run
wails build -x windows/amd64 --verbose. The error described above should appear. - Wails will claim that the project built successfully, but the build folder will be empty.
Expected behaviour The cross-compilation builds a functioning windows executable.
System Details
| Name | Value |
|---|---|
| Wails Version | v1.7.1 |
| Go Version | go1.14.2 |
| Platform | linux |
| Arch | amd64 |
| GO111MODULE | (Not Set) |
| GCC | 7.5.0 |
| Npm | 6.14.4 |
| Node | v12.17.0 |
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 25 (19 by maintainers)
@DanielKrolopp Would you mind checking out the feature branch
feature/gorootI just pushed up that allows you to specify the-gorootflag and provide the location on your drive of theGOROOTenvironment value?Passing that in causes the location on your host to be mounted at
/goinside the cross-compiler container. This should enable areplace github.com/wailsapp/wails => github.com/DanielKrolopp/wailsstyle of substitution.Example:
It was merged to
develop. I don’t know if we have cut a release yet containing it.I think I have a solution for this. Please bear with us 😃
Another user reported this on slack: using
replacein go.mod will also fail cross-compile: