简体   繁体   中英

go: gopkg.in/ldap.v3@v3.1.3: parsing go.mod

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/ldap.v3@v3.1.3: 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM