Closed cfiderer closed 4 years ago
I briefly looked into how buildTags
and testTags
, and buildFlags
are being used in different context currently - which is not pretty but complex. I don't know why this extension treats -tags
specially unlike other go build flags (see go help build
for the list of build flags).
Anyway - @ramya-rao-a we can compute and plumb the buildFlags
, buildTags
, and testTags
(only if the debugged/launched file is "_test.go" file) unless launch.json
already specifies the buildFlags
. Let me know if it breaks existing users' usages.
@cfiderer you can specify the tags (and other go build flags) using the buildFlags
field in the launch.json
.
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"env": {},
"args": [],
"buildFlags": "-tags=myTag"
}
]
}
@hyangah thank you for the tip: not nice, but a workaround.
Note on passing build tags via the debug configuration: https://github.com/microsoft/vscode-go/wiki/Debugging-Go-code-using-VS-Code#using-build-tags
Some history here:
vscode
apis that the rest of the extension does have access to. So, it cannot read settingsbuildFlags
was introduced in the debug configuration you provide in the launch.json fileDebugConfigurationProvider
interface was provided by VS Code for extensions to implement. See https://github.com/microsoft/vscode-go/blob/master/src/goDebugConfiguration.tsSo, yes. We can compute the right flags and tags in the resolveDebugConfiguration() method
Hey @cfiderer,
We are in the midst of a repo move, see We are moving section in our readme for more details.
Closing this issue in favor of https://github.com/golang/vscode-go/issues/128. Please subscribe to it for further updates
Thanks for all the support & Happy Coding!
Please direct general questions to:
Please review the Wiki before filing an issue. Helpful pages include:
Please answer these questions before submitting your issue. Thanks!
What version of Go, VS Code & VS Code Go extension are you using?
Run
go version
to get version of GoRun
code -v
orcode-insiders -v
to get version of VS Code or VS Code InsidersCheck your installed extensions to get the version of the VS Code Go extension
Run
go env GOOS GOARCH
to get the operating system and processor architecture detailsShare the Go related settings you have added/edited
Run
Preferences: Open Settings (JSON)
command to open your settings.json file. Share all the settings with thego.
or["go"]
prefixes.buildflags.zip
Describe the bug
A clear and concise description of what the bug. When I debug the main program, I end up in the doSomething() function from the withoutTag.go file (without "myTag").
A clear and concise description of what you expected to happen. I expect the configured build tag to be passed to dlv, so that the generated code uses the doSomething() function from withTag.go.
Debugging with buildflags used to work well in the past. Running the code with
go run -tags myTag .
in the Terminal window works fine.Steps to reproduce the behavior:
Use VS Code with the Go extension and the dlv debugger installed.
Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.