vscode-go
vscode-go copied to clipboard
Go doesn't recognize workspace because of capital change
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
- Run
go versionto get version of Go from the VS Code integrated terminal.- go version go1.22.0 windows/amd64
- Run
gopls -v versionto get version of Gopls from the VS Code integrated terminal.- gopls v0.15.0-pre.4
- Run
code -vorcode-insiders -vto get version of VS Code or VS Code Insiders.- version 1.85.2
- Check your installed extensions to get the version of the VS Code Go extension
- checkd with Go Nightly v2024.2.1315, and also Go v0.41.0
- Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Toolscommand.
# Tools Configuration
## Environment
GOBIN: D:/Zill_Laiss/programs/bin/
toolsGopath:
gopath: C:\Users\Xyassraist\go
GOROOT: C:\Program Files\Go
PATH: C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Common Files\Intel\Shared Files\cpp\bin\Intel64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\Xyassraist\AppData\Local\Microsoft\WindowsApps;C:\adb;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\IBM\SPSS\Statistics\25\JRE\bin;C:\Program Files\Calibre2\;C:\Program Files\nodejs\;C:\Users\Xyassraist\dart-sass;C:\Program Files\Git\cmd;C:\msys64\mingw64\bin;C:\Program Files\Go\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Common Files\Intel\Shared Files\cpp\bin\Intel64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\Xyassraist\AppData\Local\Microsoft\WindowsApps;C:\adb;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\IBM\SPSS\Statistics\25\JRE\bin;C:\Program Files\Calibre2\;C:\Program Files\nodejs\;C:\Users\Xyassraist\dart-sass;C:\Program Files\Git\cmd;C:\msys64\mingw64\bin;C:\Program Files\Go\bin;D:\Zill_Laiss\programs\bin;C:\Users\Xyassraist\go\bin;C:\Users\Xyassraist\.cargo\bin;C:\Users\Xyassraist\SurrealDB;C:\Users\Xyassraist\go\bin
## Tools
go: C:\Program Files\Go\bin\go.exe: go version go1.22.0 windows/amd64
gopls: D:\Zill_Laiss\programs\bin\gopls.exe (version: v0.15.0-pre.4 built with go: go1.22.0)
gotests: not installed
gomodifytags: not installed
impl: not installed
goplay: not installed
dlv: D:\Zill_Laiss\programs\bin\dlv.exe (version: v1.22.0 built with go: go1.22.0)
staticcheck: D:\Zill_Laiss\programs\bin\staticcheck.exe (version: v0.4.6 built with go: go1.22.0)
## Go env
Workspace Folder (go-workspace): d:\Zill_Laiss\programming\backend\Go\go-workspace
set GO111MODULE=
set GOARCH=amd64
set GOBIN=D:/Zill_Laiss/programs/bin/
set GOCACHE=C:\Users\Xyassraist\AppData\Local\go-build
set GOENV=C:\Users\Xyassraist\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Xyassraist\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Xyassraist\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.22.0
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=d:\Zill_Laiss\programming\backend\Go\go-workspace\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\XYASSR~1\AppData\Local\Temp\go-build3988885385=/tmp/go-build -gno-record-gcc-switches
Share the Go related settings you have added/edited
Default setting.
Describe the bug
If you change the lettercase of whatever letter (no other modification beside changing the lettercase) in your project path, Go will stop checking for error and there is yellow squiggly line under "package main" that tells me this error:
No active builds contain D:\Zill_Laiss\programming\backend\Go\go-workspace\main.go: consider opening a new workspace folder containing it.
I deleted the folder and created a new one with the exact same name, it gave me the same result. To get around this, I must create a new project with different name (by adding or removing one letter). So either no name changing forever or move all the projects within that folder to another one.
What I expect is that Go is not case sensitive when it comes to its pathing. I don't see why it should be in the first place.
Bug level: Annoyance
Steps to reproduce the behavior:
- Create an initial Go project somewhere, here I will use D:/Go/go-workspace
- go mod init go-workspace
- Create main.go and write this code and save.
package main
import "fmt"
func main() {
fmt.Println("test")
}
- Close VS Code, and change the path to D:/GO/go-workspace
- Relaunch VS Code and open the same project.
- Check the yellow squiggly line under package main
Screenshots or recordings
Not needed.
This looks like a dupe of golang/go#57081. Earlier versions of the extension would actually get confused and send incorrect edits in this case (because they did not correlated the two files with different spellings). I've since fixed that, but it's quite a different problem to do the right thing when VS Code and the Go command disagree about file names.
Your repro is interesting, because it looks like the canonical name of the file should have been changed, so VS Code and the Go command should agree on the casing. This warrants more investigation.
I noticed that if you change the workspace folder itself Go will recognize it and error will not occur. For example with the dir I gave before, if I change "D:/Go/go-workspace" to "D:/Go/GO-workspace", all is fine. It only occurs if the change happens in the middle. I tested with deeply nested workspace like D:\Zill_Laiss\programming\backend\GO\go-workspace\main.go (changed it to D:\Zill_Laiss\programming\BACKEND\GO\go-workspace\main.go) and that seems to be the case