-
Notifications
You must be signed in to change notification settings - Fork 757
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
codelens: ldflags do not make effects in run test #1831
Comments
Can you please add these flags to the |
It makes no difference. |
@Troublor What about the following? (no
But it's likely this setting - part of it was discussed in go-delve/delve#2718 (comment) :-( |
Hmm, after I remove the I am using
However, if I click the
|
I believe this problem is because vscode-go constructs arguments for the
As documented at https://pkg.go.dev/cmd/go#hdr-Testing_flags, To my understanding, when Perhaps the simplest fix is to specify the package as the first argument to the Line 460 in 08dacee
while the packages are appended afterwards at Line 475 in 08dacee
so would it be possible to try and reverse the ordering? |
This change accepts both string type and []string (actually, []interface{} type due to Go's json decoding behavior. Fixes go-delve#2718 For golang/vscode-go#1831, golang/vscode-go#1027
This change accepts both string type and []string. dap.BuildFlags is a union of string and []string. Fixes go-delve#2718 For golang/vscode-go#1831, golang/vscode-go#1027
This change accepts both string type and []string. dap.BuildFlags is a union of string and []string. Fixes go-delve#2718 For golang/vscode-go#1831, golang/vscode-go#1027
This change accepts both string type and []string. dap.BuildFlags is a union of string and []string. Fixes go-delve#2718 For golang/vscode-go#1831, golang/vscode-go#1027
This change accepts both string type and []string. dap.BuildFlags is a union of string and []string. Fixes go-delve#2718 For golang/vscode-go#1831, golang/vscode-go#1027
This change accepts both string type and []string. dap.BuildFlags is a union of string and []string. Fixes #2718 For golang/vscode-go#1831, golang/vscode-go#1027
Is there any update on this? This breaks running individual tests in the testify suite. Is there any workaround? |
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.go version go1.17.2 linux/amd64
gopls -v version
to get version of Gopls from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.v0.28.1
Go: Locate Configured Go Tools
command.Share 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 the
go.
or["go"]
orgopls
prefixes.Describe the bug
A clear and concise description of what the bug.
The
ldflags
:-extldflags=-Wl,--allow-multiple-definition'
does not take effect when I run tests by clicking therun test
button in the editor beside the test definition.Compilation errors complain the multiple definitions of C functions.
The multiple definitions of
secp256k1*
functions are expected since I used two packages, one of which is a fork of the other, and they contains some identical C code.Outputs are as follows:
Multiple definition
compilation errors should not be thrown.When I copy & paste the command
/home/troublor/.gvm/gos/go1.17.2/bin/go test -timeout 30s -run ^TestVersion$ github.com/Troublor/erebus/packages/erebus-hunter -ldflags='-X=main.version=1.0' -ldflags='-extldflags=-Wl,--allow-multiple-definition'
in the viscode integrated terminal, it executes with no error and the test passes.Interestingly,
debug test
functionality works well.Steps to reproduce the behavior:
As described in the previous section.
Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
The text was updated successfully, but these errors were encountered: