-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add Windows and MacOS configuration section #4662
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
Open
Romerolweb
wants to merge
3
commits into
wailsapp:master
Choose a base branch
from
Romerolweb:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+50
−0
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: wailsapp/wails
Length of output: 2956
🌐 Web query:
VS Code Go debugger launch.json macOS GOARCH environment variable best practices💡 Result:
Best practices:
GOARCHin VS Code Go debug (launch.json) on macOSDon’t set
GOARCHunless you truly need it.For normal local debugging, let Go/Delve use your host defaults (Apple Silicon:
darwin/arm64; Intel:darwin/amd64).GOARCHis primarily a build target selector (often paired withGOOS). [2]If you do set
GOARCH, ensure the whole toolchain matches (Go +dlv+ the binary).Debugging generally assumes the compiled binary matches the architecture Delve is running under. Practically:
GOARCH=arm64and an arm64dlv.amd64) build on Apple Silicon, use a consistent x86_64 toolchain (often meaning running the relevant tools under Rosetta and using an amd64dlv). (Mixing arch is a common cause of “breakpoints don’t hit / weird debugger behavior”.)Use
env/envFilecorrectly: they apply to the debuggee process environment.In
launch.json,envdefines environment variables passed to the launched program, and it merges withenvFile(andgo.toolsEnvVars) with precedenceenv>envFile>go.toolsEnvVars. [1]If you need a different
GOARCHonly for the build, build in apreLaunchTaskand debug with"mode": "exec"—don’t rely onlaunch.json envto affect the build step.The VS Code Go docs explicitly note that settings like
envinlaunch.jsonapply to running the compiled binary, not building it—so put build env/flags in the task. [3]Example: build
amd64binary via task, then debug it (recommended pattern).vscode/tasks.json
{ "version": "2.0.0", "tasks": [ { "label": "go: build (debug, amd64)", "type": "shell", "command": "go", "args": ["build", "-gcflags=all=-N -l", "-o", "${workspaceFolder}/__debug_bin_amd64", "./cmd/myapp"], "options": { "env": { "GOARCH": "amd64" } } } ] }.vscode/launch.json
{ "version": "0.2.0", "configurations": [ { "name": "Debug exec (amd64 build)", "type": "go", "request": "launch", "mode": "exec", "program": "${workspaceFolder}/__debug_bin_amd64", "preLaunchTask": "go: build (debug, amd64)" } ] }Sources: VS Code Go debug config env/envFile behavior [1]; what
GOARCHdoes for builds [2]; why build env should live in the pre-launch task (launch env doesn’t apply to building) [3].macOS launch config is inconsistent with the shown build task and hardcodes incompatible GOARCH.
The generic
tasks.jsonbuilds tobuild/bin/myproject.exe, but the macOSlaunch.jsontargetsbuild/bin/myproject(no.exe), causing a mismatch. Additionally, hardcodingGOARCH: "amd64"fails on Apple Silicon (arm64 hosts). If GOARCH must differ for builds, it belongs in the task'soptions.env, not inlaunch.json(whereenvonly affects the debuggee process, not the build). For local debugging on macOS, omit GOARCH entirely to use the host default, or conditionally set it based on the actual machine architecture.💡 Proposed doc fix (align macOS config with proper build/arch handling)
🤖 Prompt for AI Agents