Go (lang) can not find module

Issue

I did go get github.com/nanobox-io/golang-scribble, but when i try to run the main.go i get the error

[jerome@thearch beer-server]$ go run main.go
../../pkg/storage/json/repository.go:14:2: cannot find package "github.com/nanobox.io/golang-scribble" in any of:
    /usr/lib/go/src/github.com/nanobox.io/golang-scribble (from $GOROOT)
    /home/jerome/Documents/code/go/domainhex/src/github.com/nanobox.io/golang-scribble (from $GOPATH)

so i searched it:

[jerome@thearch nanobox-io]$ find /home/jerome/Documents/code/go/domainhex/src/github.com/nanobox.io -name golang-scribble
find: ‘/home/jerome/Documents/code/go/domainhex/src/github.com/nanobox.io’: No such file or directory

There is the thing completly weird, i cd follow the link and the package golang-scribble is present at the right place. So i pwd to get the path and use it to run the same cmd as previously

[jerome@thearch nanobox-io]$ pwd
    /home/jerome/Documents/code/go/domainhex/src/github.com/nanobox-io
    
[jerome@thearch nanobox-io]$ ls
    golang-scribble
    
[jerome@thearch nanobox-io]$ find /home/jerome/Documents/code/go/domainhex/src/github.com/nanobox-io  -name golang-scribble
        /home/jerome/Documents/code/go/domainhex/src/github.com/nanobox-io/golang-scribble

I don t know what’s wrong ?
If i add some other package like github.com/google/uuid or julienschmidt/httprouter, it works perfectly.

extra-info

go version go1.16.2 linux/amd64
GO111MODULE="auto"
GOPATH="/home/jerome/Documents/code/go/domainhex"

Operating System: Arch Linux
Kernel: Linux 5.11.6-arch1-1
Architecture: x86-64

Solution

You are doing go get on github.com/nanobox-io/golang-scribble but you’re importing github.com/nanobox.io/golang-scribble, the difference being nanobox-io vs nanobox.io. Try changing your import statement to github.com/nanobox-io/golang-scribble.

Answered By – Simon S.

Answer Checked By – Katrina (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.