No module path for go.mod file..HELP

image

Hi!
what are you trying to do? Is your problem related with importing module from file://path/to/somewhere?

hello. I am trying to save in vsc and also have the ability to use go run.image.png

hmm. What module do you want to import? is it a standard module like github.com/author/repo or something else? could you post code.
maybe try to run something like go mod tidy

I’m able to reproduce this behavior.
it looks like your go.mod file (module info file in root of your project) exists, but is empty.
pleas remove it and create by go mod init [modulename]
instead of [modulename] put whatever you want (like example.com, or github.com/user/repo)

1 Like

Ok, thanks so much!!

Hello, I am not completely sure but I think my question is in line with the topic. Basically i am trying to import resty module by $go get -v github.com/go-resty/resty/v2

after the execution of the aforementioned command inside my folder github.com, folder go-resty appears with two other folders inside: resty and resty@v1.12.0 (go/pkg/mod/go-resty/…)

So it looks like the module is being imported but when i run my .go file following error occurs:

the same error when running go install main.go and go build main.go

Would love to hear any suggestions. Thank you much!!!

try go mod init [modulename] e.g. go mod init example.com
and go mod tidy

Thank you @gucio321! I have actually tried all of the above to no avail. After two days of fighting with this package finally i figured out that the issues was in the name. On their official github documentation it says

module github.com/go-resty/resty/v2 with respective import name

but in fact it supposed to be

module gopkg.in/go-resty/resty.v2
($ go get gopkg.in/go-resty/resty.v2 )

import “gopkg.in/go-resty/resty.v2”

Here is the link to the where i found it. https://gopkg.in/go-resty/resty.v2
Hope it will help someone. Thanks again for your response @gucio321