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

run test pass ldflags not work with --ldflags -r=/home/xxxx/go/src/program/clib #3025

Closed
yiGmMk opened this issue Oct 27, 2023 · 7 comments
Closed

Comments

@yiGmMk
Copy link

yiGmMk commented Oct 27, 2023

What version of Go, VS Code & VS Code Go extension are you using?

go version go1.21.3 linux/amd64
golang.org/x/tools/gopls v0.13.2
golang.org/x/tools/[email protected] h1:Pyvx6MKvatbX3zzZmdGiFRfQZl0ohPlt2sFxO/5j6Ro=

vscode

Version: 1.83.1 (user setup)
Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc
Date: 2023-10-10T23:48:05.904Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045

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"] or gopls prefixes.

Describe the bug

my project needs a .so to work,it works with cmd like this in bash shell,however with button 'run test' above tests it doesn't

go test -timeout 30s -tags linux -run ^TestGenCode$ program --ldflags -r=/home/xxxx/go/src/program/clib

err:

go test -timeout 30s -tags linux -run ^TestGenCode$ program --ldflags -r=/home/xxxx/go/src/program/clib

/tmp/go-build3735271922/b001/program.test: error while loading shared libraries: xxxxxx.so: cannot open shared object file: No such file or directory
FAIL	program   0.001s
FAIL

Steps to reproduce the behavior:

  1. click ''run test'

Screenshots or recordings

image

@gopherbot gopherbot added this to the Untriaged milestone Oct 27, 2023
@yiGmMk
Copy link
Author

yiGmMk commented Oct 27, 2023

run test doesn't work,however 'debug test' works also the same cmd works in bash shell,so i think it may a bug

@yiGmMk
Copy link
Author

yiGmMk commented Oct 27, 2023

may be caused by different param handle of 'debug test' and 'run test'
"go.buildFlags": [
"--ldflags -r=${workspaceRoot}/clib" // works for debug test but not run test
// "-ldflags=-r ${workspaceRoot}/clib" // works for run test but not debug test
],

@findleyr
Copy link
Member

findleyr commented Nov 2, 2023

Related: #1831.

@hyangah will know better, but I think we may soon be able to use "-ldflags=-r ${workspaceRoot}/clib" for both run test and debug test?

@findleyr
Copy link
Member

findleyr commented Nov 2, 2023

Can you also try "--ldflags=-r=${workspaceRoot}/clib"? Does that work for both?

@yiGmMk
Copy link
Author

yiGmMk commented Nov 3, 2023

Can you also try "--ldflags=-r=${workspaceRoot}/clib"? Does that work for both?

works for both 'debug test' and 'run test'

@findleyr
Copy link
Member

findleyr commented Nov 3, 2023

Thanks. Then let's close this as a dupe of #1831

@findleyr findleyr closed this as not planned Won't fix, can't repro, duplicate, stale Nov 3, 2023
@Luranss
Copy link

Luranss commented Nov 4, 2023

👍👍

@golang golang locked and limited conversation to collaborators Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants