I just imported the go-ethereum project in GoLand. But the configuration shows the error below, how to solve it?
1 Answer
go-ethereum
uses Go Modules. This means that you can clone the project anywhere in your system and use it from there.
Assuming that you are using a reasonably new version of the IDE, such as 2020.2.2, when a Go Modules based project is opened, it will automatically turn on the support for them. If it's not, for whatever reason, go to Settings/Preferences | Go | Go Modules
and enable it.
You can also use the Go Modules based projects from GOPATH itself, but in that case you should manually enable/check that the IDE enabled the Go Modules support for you.
You should also double-check your GOPATH setting to match what you expect it to be in the system, in your case it should be C:\tools
and you can check the value under Settings/Preferences | Go | GOPATH
. This will ensure that the Go Modules cache is shared between the system (terminal) and the IDE and no extra space is required (or wasted).
Finally, the error is probably due to either the GOPATH not being configured correctly or the Go Modules being turned off. Check those first and proceed from there.