golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.87k stars 752 forks source link

Rename (F2) does not apply to code for different GOOS/GOARCH #3473

Closed yuwenlong closed 2 months ago

yuwenlong commented 2 months ago

Type: Bug

When writing a go program, for example, there are the following files and codes in the statistics directory:

common.go

package pack

type XxPach struct{}

pack_linux.go

//go:build linux && !android && !ios

package pack

func (x *XxPach) Xxxx() {}

pack_windows.go

//go:build windows

package pack

func (x *XxPach) Xxxx() {}

In the wsl2 environment, if you use the F2 shortcut key to modify the structure name in common.go, you will find that pack_linux.go will be modified accordingly, but pack_windows.go will not be modified.

Maybe it’s because I’m in a Linux environment at this time, but I still hope that F2 can make global changes, thank you!

VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:06:49.809Z) OS version: Windows_NT x64 10.0.22635 Modes: Remote OS version: Linux x64 6.6.36.3-microsoft-standard-WSL2 Remote OS version: Linux x64 6.6.36.3-microsoft-standard-WSL2 Remote OS version: Linux x64 6.6.36.3-microsoft-standard-WSL2 Remote OS version: Linux x64 6.6.36.3-microsoft-standard-WSL2 Remote OS version: Linux x64 6.6.36.3-microsoft-standard-WSL2 Remote OS version: Linux x64 6.6.36.3-microsoft-standard-WSL2

System Info |Item|Value| |---|---| |CPUs|11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (16 x 2496)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.73GB (5.47GB free)| |Process Argv|--crash-reporter-id 1e8dec60-dbc3-426a-8f86-cff6c7b4f68d| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 6.6.36.3-microsoft-standard-WSL2| |CPUs|11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (16 x 0)| |Memory (System)|15.48GB (11.44GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 6.6.36.3-microsoft-standard-WSL2| |CPUs|11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (16 x 0)| |Memory (System)|15.48GB (11.44GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 6.6.36.3-microsoft-standard-WSL2| |CPUs|11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (16 x 0)| |Memory (System)|15.48GB (11.44GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 6.6.36.3-microsoft-standard-WSL2| |CPUs|11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (16 x 0)| |Memory (System)|15.48GB (11.44GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 6.6.36.3-microsoft-standard-WSL2| |CPUs|11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (16 x 0)| |Memory (System)|15.48GB (11.44GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 6.6.36.3-microsoft-standard-WSL2| |CPUs|11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (16 x 0)| |Memory (System)|15.48GB (11.44GB free)| |VM|0%|
Extensions (47) Extension|Author (truncated)|Version ---|---|--- project-manager|ale|12.8.0 rust-syntax|dus|0.6.1 auto-rename-tag|for|0.1.10 copilot|Git|1.214.0 copilot-chat|Git|0.17.1 vscode-drawio|hed|1.6.6 remote-containers|ms-|0.375.1 remote-ssh|ms-|0.112.0 remote-ssh-edit|ms-|0.86.0 remote-wsl|ms-|0.88.2 remote-explorer|ms-|0.4.3 php-docblocker|nei|2.7.0 shellman|Rem|5.7.0 vscode-icons|vsc|12.8.0 vscode-nginx|wil|0.7.2 rust-bundle|1Yi|1.0.0 go-group-imports|ale|1.2.0 vscode-intelephense-client|bme|1.10.4 vscode-better-align|cho|1.4.2 githistory|don|0.6.20 rust-syntax|dus|0.6.1 gitlens|eam|15.2.0 vscode-html-css|ecm|2.0.10 dependi|fil|0.7.4 shell-format|fox|7.2.5 go|gol|0.42.0 todo-tree|Gru|0.0.226 vscode-insertdatestring|jsy|2.3.1 jumpprotobuf|ldc|0.0.3 rainbow-csv|mec|3.12.0 php-namespace-resolver|Meh|1.1.9 git-graph|mhu|1.30.0 vscode-fileheader|mik|0.0.2 vscode-language-pack-zh-hans|MS-|1.91.2024071009 cpptools|ms-|1.21.3 powershell|ms-|2024.2.2 php-docblocker|nei|2.7.0 vscode-protolint|ple|0.8.0 rust-analyzer|rus|0.3.2045 vscode-proto|san|0.0.6 markdown-preview-enhanced|shd|0.8.13 lua|sum|3.9.3 even-better-toml|tam|0.19.2 shellcheck|tim|0.37.1 change-case|wma|1.0.0 php-debug|xde|1.35.0 save-as-root|yy0|1.8.0
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492:30256859 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 jg8ic977:31013176 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupyter:31046869 impr_priority:31102340 refactorc:31101458 ccplt:31098110 pythonrstrctxt:31093869 ```
hyangah commented 2 months ago

This is a limitation in gopls. pack_linux.go and pack_windows.go are in different builds, and the rename functionalities don't apply to all build configurations. @findleyr Even though I believe this is a known issue, I cannot find any open issue about this in the gopls issue tracker. Can you please help find us the upstream issue?

findleyr commented 2 months ago

Thanks @hyangah. This is a dupe (in spirit) of golang/go#65755.