Search code examples
goland

Goland IDE complains about builtin types


I have a project which is intended to have completely own environment. That means:

  1. The Go language compiler and tools are installed inside the project's folder (in .deps\go subfolder).
  2. Similarly, the project has own GOPATH folder.
  3. Also, this project uses the Go modules approach.

There is a special build.cmd file which sets GOROOT and GOPATH accordingly and builds the application. That cmd file works fine.

But, when I open the project in GoLand, it shows a lot of complains like "Unexported type usage" about all builtin types, such as string, bool, float64, etc.

This is a screenshot of how it looks like in GoLand This is a screenshot of how it looks like in GoLand When I Ctrl-click on the type name I'm getting to the builtin.go file inside the custom GOROOT, but it is shown with a lot of "Invalid recursive type" errors: A screenshot fo the <code>builtin.go</code> file

The GOROOT and GOPATH settings in the Settings dialog are set accordingly (but there is another installation of the Go tools on the computer, if that does matter). Here are my settings on the GOPATH tab

The question is: why GoLand produces those complains and what should I do to overcome them?


Solution

  • The problem is that the Go SDK is located inside the project so GoLand thinks that the user's files are inside. Excluding the .deps directory in Preferences | Project Structure should help.

    enter image description here