Find usages does not find in main package in cmd folder
I have a project which has the source for various executables (package main) in the cmd folder below the project root. Each executable is in its own subdirectory:
cmd/server/server-main.go
cmd/client/client-main.go
I have common code in the pkg directory:
pkg/package1/file1.go
When I do find usages of something the pkg directory, GoLand does not find usages in the cmd folder. It also does not do refactorings (e.g. rename). How do I make it include the cmd directory in the Go source code to consider?
Please sign in to leave a comment.
What's the GOPATH for your project? How do you import pkg package in your command line packages? How did you configure the GOPATH in the IDE?
My GOPATH is ~/.local
This is also set in IDE (as Global GOPATH)
> How do you import pkg package in your command line packages?
Still actual.
Also where is your code is located?
in "/home/duncan/.local/src/github.com/sensiblecodeio/projectname/cmd/server/server-main.go" I have:
which imports files from:
/home/duncan/.local/src/github.com/sensiblecodeio/projectname/pkg/dir
Do you use Go modules for the project? If no, enable `Index entire GOPATH` and disable Go modules integration in `Settings | Go | Go Modules` if needed
Yes I do use Go Modules. However I am still inside GOPATH because prior to using GoLand I was using tools which depended on gorename which only works inside GOPATH. Would it help to move outside GOPATH?
Ok, it changes the diagnostics a bit.
What's the content of go.mod file?
Could you launch `go list -m -json all` in the builtin terminal in your Go Module? What's the output?
Switching this thread to a support call: don't want to post too much private project info in public.