Skip to content

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

Closed as not planned
@yiGmMk

Description

@yiGmMk

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions