Description
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
$ go version
go version go1.24.1 darwin/arm64
Version: 1.98.2 (Universal)
Commit: ddc367ed5c8936efe395cffeec279b04ffd7db78
Date: 2025-03-12T13:32:45.399Z (1 wk ago)
Electron: 34.2.0
ElectronBuildId: 11161602
Chromium: 132.0.6834.196
Node.js: 20.18.2
V8: 13.2.152.36-electron.0
OS: Darwin arm64 23.6.0
Tools Configuration
Environment
GOBIN: undefined
toolsGopath:
gopath: /Users/firefly/go
GOROOT: /usr/local/go
Tools
go: /usr/local/go/bin/go: go version go1.24.1 darwin/arm64
gopls: /Users/firefly/go/bin/gopls (version: v0.18.1 built with go: go1.24.1)
gotests: /Users/firefly/go/bin/gotests (version: v1.6.0 built with go: go1.24.1)
gomodifytags: /Users/firefly/go/bin/gomodifytags (version: v1.17.0 built with go: go1.24.1)
impl: /Users/firefly/go/bin/impl (version: v1.4.0 built with go: go1.24.1)
goplay: /Users/firefly/go/bin/goplay (version: v1.0.0 built with go: go1.24.1)
dlv: /Users/firefly/go/bin/dlv (version: v1.24.1 built with go: go1.24.1)
Share the Go related settings you have added/edited
i added nothing to the settings
Describe the bug
When running a Go test in VSCode using the **"Run Test"** button, Chinese characters copied to the clipboard are corrupted. However, when running the same test via the terminal using go test, the clipboard content is correct.
Steps to Reproduce
Code Example:
func TestClipboard(t *testing.T) {
if err := clipboard.WriteAll("中文"); err != nil {
t.Fatal(err)
}
}
Run in VSCode:
Open the Go file containing the above code.
Click the **"Run Test"** button from the GO Extension to execute the test.
Run in Terminal:
go test -v -run TestClipboard
Expected Result
Regardless of whether the test is run in VSCode or the terminal, the clipboard content should be: 中文
Actual Result
Run in VSCode:
Clipboard content is: 中文
Run in Terminal:
Clipboard content is correct: 中文