-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
x/tools/gopls: documentation, error messages, and mod tidy behavior can make adding a dependency confusing #60935
Comments
please show real commands and output |
Sure! C:\dev\projects\golang Under C:\dev\projects\golang\src I have all my many projects and under some projects I have sub-projects. Besides I have go.work JUST under my root src dir. Whenever I create a new project I type
Then inside go.work I have like this
Now let's suppose I wanna add some Github module to my project "clientA\project01" to be used. After this moment I realised that the repository github.com/bla/bla/bla is downloaded to C:\dev\projects\golang\pkg\mod not to C:\dev\projects\golang\src\github.com as I was imagining would be done. Into my Go file where the module will be used, I set "github.com/bla/bla/bla" in imports.
I have the warning that this module "could not be find under GOROOT or GOPATH"!!! Please, Where am I doing wrong?? I spent many many many stressed hours trying to understand and fixing this issues when it comes about projects and modules management. Thanks in advance |
I understand your frustration with the documentation / tutorials. |
I have retitled this issue with what I think is the real problem: our documentation, tutorials, and behavior of gopls and the go command can make the simple act of adding a dependency confusing and error prone. I certainly think this is something we can and should fix. Please correct me if I am misrepresenting your experience. I am putting this in the gopls@v0.13.0 milestone, as I think it falls into a broad category of onboarding, go command integration, and error messages that we're collecting into that release. |
What version of Go are you using (
go version
)?go env
OutputWhat did you do?
I installed all my Go dev environment from zero, by Go 1.20
I set my GOPATH as env above, then I set my go.work file on the root from my workspace, like the official ref says to do.
After typing "go get github.com/any/module/example", the project are downloaded to GOMODCACHE but Golang says that "could not find the package", and I just ask "why???"
It really uncomfortable when you follow the official reference and this happen, seems that Google engineers don't understand how workspace and dependency works, and I really don't wanna believe on it.
What did you expect to see?
I expect see golang finding the packages after "go get"
What did you see instead?
Golang cant find the packages under his own structure.
The text was updated successfully, but these errors were encountered: