Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-compiler flag is ignored in binding generation #3120

Closed
xtrafrancyz opened this issue Dec 12, 2023 · 1 comment · Fixed by #3121
Closed

-compiler flag is ignored in binding generation #3120

xtrafrancyz opened this issue Dec 12, 2023 · 1 comment · Fixed by #3121
Labels
Bug Something isn't working

Comments

@xtrafrancyz
Copy link
Contributor

Description

Command wails build -compiler go1.20.12 fails to complete when default go version installed is 1.21. The reason is binding generation process where there is no compiler setting. Go 1.21 forcibly adds line toolchain go1.21.5 to go.mod file and it becomes broken for 1.20.

if options.GoModTidy {
stdout, stderr, err = shell.RunCommand(workingDirectory, "go", "mod", "tidy")
if err != nil {
return stdout, fmt.Errorf("%s\n%s\n%s", stdout, stderr, err)
}
}
stdout, stderr, err = shell.RunCommand(workingDirectory, "go", "build", "-tags", tagString, "-o", filename)

It would also be nice for wails dev to support -compiler flag to avoid manual editing go.mod for release build.

To Reproduce

  1. Install latest Go version (1.21) globally
  2. Install Go 1.20 https://go.dev/doc/manage-install (go install golang.org/dl/go1.20.12@latest, go1.20.12 download)
  3. Create Wails project wails init
  4. Remove toolchain 1.21.x from go.mod and change version to go 1.20
  5. Run wails build -compiler go1.20.12

Error output:

go.mod:5: unknown directive: toolchain
  ERROR   exit status 1

Expected behaviour

Compilation successful with Go 1.20

Screenshots

No response

Attempted Fixes

Workaround: wails build -compiler go1.20.12 -skipbindings and edit go.mod every time before build.

System Details

# Wails
Version | v2.7.1

# System
┌───────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Windows 10 Home Single Language                                            |
| Version      | 2009 (Build: 22621)                                                        |
| ID           | 22H2                                                                       |
| Go Version   | go1.21.5                                                                   |
| Platform     | windows                                                                    |
| Architecture | amd64                                                                      |
| CPU          | Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz                                  |
| GPU 1        | NVIDIA GeForce MX350 (NVIDIA) - Driver: 31.0.15.3203                       |
| GPU 2        | Intel(R) Iris(R) Plus Graphics (Intel Corporation) - Driver: 31.0.101.2114 |
| Memory       | 16GB                                                                       |
└───────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌───────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version       |
| WebView2   | N/A          | Installed | 120.0.2210.61 |
| Nodejs     | N/A          | Installed | 20.10.0       |
| npm        | N/A          | Installed | 10.2.3        |
| *upx       | N/A          | Installed | upx 4.2.1     |
| *nsis      | N/A          | Installed | v3.08         |
└─────────────── * - Optional Dependency ───────────────┘

Additional context

Compilation with 1.20 is needed for Windows 7, although there is no official support, but it works

@xtrafrancyz xtrafrancyz added the Bug Something isn't working label Dec 12, 2023
@leaanthony
Copy link
Member

Great idea. Happy to accept a PR for this 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants