Go Mod trying to download a non-existent package

1.1k views Asked by At

Go mod giving below error when I use command go mod tidy

go: finding module for package github.com/NirmalVatsyayan/Backend/MySqlDBLib/MySqlConnInit
github.com/NirmalVatsyayan/UserService/Handler imports
        github.com/NirmalVatsyayan/MySqlDBLib/Model imports
        github.com/NirmalVatsyayan/Backend/MySqlDBLib/MySqlConnInit: cannot find module providing package github.com/NirmalVatsyayan/Backend/MySqlDBLib/MySqlConnInit: module github.com/NirmalVatsyayan/Backend/MySqlDBLib/MySqlConnInit: gi
t ls-remote -q origin in /Users/nirmalvatsyayan/gocode/pkg/mod/cache/vcs/49cdef3e2697979b0da
938baa0f74bd154458398de9ef7d91f6a7c1ab8936bdd: exit status 128:
        remote: Repository not found.
        fatal: repository 'https://github.com/NirmalVatsyayan/Backend/
' not found

The problem is it is still trying to refer a path github.com/NirmalVatsyayan/Backend/MySqlDBLib/MySqlConnInit which is non-existent now, it is github.com/NirmalVatsyayan/MySqlDBLib/MySqlConnInit. In line 3 it is pointing to the correct path github.com/NirmalVatsyayan/MySqlDBLib/Model imports but in line 4 it's pointing to older path again github.com/NirmalVatsyayan/Backend/MySqlDBLib/MySqlConnInit. Why is go mod pointing to a repo which no longer exists even when it's basically pointing to new repo first.

There is no reference of github.com/NirmalVatsyayan/Backend/MySqlDBLib/MySqlConnInit internally from github.com/NirmalVatsyayan/MySqlDBLib/Model, in code it does refer to correct directory which is github.com/NirmalVatsyayan/MySqlDBLib/MySqlConnInit

1

There are 1 answers

0
ttrasn On

you can use the replace option in your go.mod

like :

replace (
    fake/path/of/package => ../real/address
)

then run go build your_main_file.go or go run your_main_file.go