1

I recently added a new package and directory to my Go project, and now when I try to build it, I get errors about a password error on Gitlab.

I am not importing a new remote package, I am simply adding a new directory underneath my already declared module path. For instance, my go.mod has gitlab.com/example/api and the package I added is gitlab.com/example/api/postgres.

I am not actually hosting on gitlab, I just needed something to name the project as I worked on it. Clearly it won't find it on gitlab, but it is available locally. Why is go-get trying to download a package/path that is available locally?

Why is it only happening for this new package, and not for all of the existing package under this path?

Golang 1.14

Mantas Vidutis
  • 16,376
  • 20
  • 76
  • 92

1 Answers1

2

You have to add replace above the require block in your go.mod to work with local package. For example:

replace gitlab.com/example => /Users/abc/projects/gitlab.com/example

Ref: https://github.com/golang/go/wiki/Modules

nguyenhoai890
  • 1,189
  • 15
  • 20