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?

0
8 comments

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?

 
 
0

My GOPATH is ~/.local
This is also set in IDE (as Global GOPATH)

0

> How do you import pkg package in your command line packages?

Still actual.

Also where is your code is located?

 

0

in "/home/duncan/.local/src/github.com/sensiblecodeio/projectname/cmd/server/server-main.go" I have:

import "github.com/sensiblecodeio/projectname/pkg/dir"

which imports files from:

/home/duncan/.local/src/github.com/sensiblecodeio/projectname/pkg/dir

 

0

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

0

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?

0

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?

0

Switching this thread to a support call: don't want to post too much private project info in public.

0

Please sign in to leave a comment.