-
Notifications
You must be signed in to change notification settings - Fork 798
Variables and types marked as Undeclared when they are declared in another .go file of the same package #277
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
Comments
Thanks for the report @saulortega
and capture the traces from |
@saulortega You can select commands from the Command Palette (Ctrl+Shift+P) https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette The project should be under You can install the previous extension version following this instruction https://code.visualstudio.com/updates/v1_30#_install-previous-versions |
Ok.
I added this:
But, I dont know how to do the traces from gopls. |
@saulortega If you are using the language server and your project is outside the GOPATH (assuming you are working in GOPATH mode - i.e. no The traces is in the |
To install the previous version (more than a month old code base, so I guess that's sufficient for testing), |
It seems like the VS Code's "Install another version" feature doesn't work for our extension for now. I filed microsoft/vscode#101509 Language server is the one that compute intellisense, and Go program analysis. https://github.com/golang/vscode-go#language-server From your original report, I see If you are using the modules mode, check the pinned issue #275 explaining the current limitation depending on how the repository is origanized. If the previous version works, let us know. |
Well, y ran that outside of my Go root directory. Here is
The previous version doesn't work. Ok, I realized the checks work fine when I open VS Code from my Go code's root directory. I was opening it one level above, same as the |
@saulortega Thanks for the update. Yes, currently, the workspace root and the module root need to be aligned when working in modules mode. #275 describes a workaround. We hope to be fixed in the future releases of the language server ( I will close this issue because we already have open cases for this problem. BTW if the frontend/backend are developed/released together, it's not a bad idea to place go.mod at the root of the repo. By placing |
Uh oh!
There was an error while loading. Please reload this page.
What version of Go, VS Code & VS Code Go extension are you using?
go version
to get version of Gocode -v
orcode-insiders -v
to get version of VS Code or VS Code Insidersgo env
to get the go development environment detailsGO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/saul/.cache/go-build" GOENV="/home/saul/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/saul/go:/home/saul/go/src/algo/Librerias" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build371168830=/tmp/go-build -gno-record-gcc-switches"
Describe the bug
A few days ago I was prompted for install the Go extension (I already had it installed and working well, but I clicked in order to maybe update)
After that new installation, it doesn't recognize the variables/types in another file of the same package. They are marked as Undeclared.
Screenshots or recordings
"Sitio" type defined in sitio.go:
Sitio declared in another file:
The text was updated successfully, but these errors were encountered: