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?

8 comments
Comment actions Permalink

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
Comment actions Permalink

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

0
Comment actions Permalink

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

Still actual.

Also where is your code is located?

 

0
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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.