Reputation: 54
go: cannot find main module, but found Gopkg.lock in
C:\Users\<github>
to create a module there, run:
cd ..\..\.. && go mod init
I get the following error after executing go mod init and go mod tidy
go: gopkg.in/[email protected]: parsing go.mod:
module declares its path as: github.com/go-ldap/ldap/v3
but was required as: gopkg.in/ldap.v3
My code only has imports for gopkg.in/ldap.v3 not sure which vendor module or package has import for github.com/go-ldap/ldap/v3
Please help in resolving this issue.
Upvotes: 0
Views: 414
Reputation: 241
scenario 1: If you are using an old import path which was deprecated, you have to update your import path to github.com/go-ldap/ldap/v3 in your go.mod
scenario 2: You may have an old import in your code! Refactor your code to the new import path.
For the first scenario:
go clean -modcache
go get github.com/go-ldap/ldap/v3
go mod tidy
Upvotes: 1