You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ go env
set CGO_CFLAGS=-O2 -g
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\user\AppData\Local\Temp\go-build1680866235=/tmp/go-build -gno-record-gcc-switches
What 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:
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.
C:\dev\projects\golang\src\clientA\project01 (under here I have .go files and go.mod)
C:\dev\projects\golang\src\clientA\project02 (under here I have .go files and go.mod)
C:\dev\projects\golang\src\clientB\project01 (under here I have .go files and go.mod)
C:\dev\projects\golang\src\myOtherProject (under here I have .go files and go.mod)
Whenever I create a new project I type go work use . , example:
go work use .
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.
Then, under my GOPATH, I type (I use go install since go get is deprecated) : go install github.com/bla/bla/bla
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.
Then I type (I don't understand for sure why I have to do it, I think I red at some tutorial after downloading a new module I have to tidy my project module)
go mod tidy
I have the warning that this module "could not be find under GOROOT or GOPATH"!!!
I'm using VS Code IDE.
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.
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 firstname.lastname@example.org 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.