Answer the question
In order to leave comments, you need to log in
Tests and gopath not working, how to fix?
It pulls up the paths,
but when importing, it writes an error that
gopath is not found,
why is it not pulling up? I can not understand.
For some reason, the tests do not work, when you click on the method name, alt + enter does not offer anything, like it should suggest creating a test. If you create a file with your hands, it swears at startup, found that you need to check the box, but it did not help.
this is what it says when i run the test
Answer the question
In order to leave comments, you need to log in
Disable GOPATH integration (File | Settings | GOPATH | Index entire GOPATH), initialize a new go.mod file (go mod init at the root of the project) and then go to import, press Alt+Enter and the Sync Dependencies button should appear.
After that, the dependencies will be added to the go.mod file and will be successfully resolved.
I advise you not to use the GOPATH approach anymore, because in future versions of Go it will already go as deprecated.
PS if you will be using Go Modules and want to import a local project, then I recommend to refer to this article: https://golangbyexample.com/import-local-module-golang/
PSS the best explanation of how it all works is in the official documentation: https:/ /golang.org/doc/code#Workspaces
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question