Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help fix go.mod mess #246

Closed
johnweldon opened this issue Nov 7, 2019 · 8 comments
Closed

Help fix go.mod mess #246

johnweldon opened this issue Nov 7, 2019 · 8 comments

Comments

@johnweldon
Copy link
Member

Help wanted to try fix the go.mod mess for this library.

Issues #238, #240, #242 and related pull requests were an attempt to get the ldap library working as a go module.

It doesn't appear to have worked correctly, and I don't have a lot of time to fix this.

Any help from a go modules veteran would be appreciated!

@johnweldon
Copy link
Member Author

for context

I think Go modules expect that v2 and higher are referenced with a version in the import path (github.com/go-ldap/ldap/v3 or something) in this case. (#241 was on the right track I think, but I prematurely closed it)

@johnweldon johnweldon pinned this issue Nov 7, 2019
@johnweldon
Copy link
Member Author

#241 was merged and I think this fixes things.

I had to do a go get github.com/go-ldap/ldap/[email protected] to get the tool to find it properly though.

@stefanmcshane
Copy link
Contributor

I think #241 was along the right lines, however it should have been moved into a v3 subdirectory (or branch)
https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher

To prevent any real breaking changes, they also suggest that we increment the version to v4. It falls out of line LDAPv3 but could prevent any further breaking changes caused by this and asn1-ber.v1

@johnweldon
Copy link
Member Author

I think this is resolved.

@dtenenba
Copy link

dtenenba commented Dec 23, 2019

@johnweldon I'm still having go mod issues, but part of the problem could be that I don't know what I am doing.

$ go version
go version go1.13.4 darwin/amd64

Here I am trying to build a project that depends on this one:

$ cat bla.go
package main

import (
	"crypto/tls"
	"github.com/go-ldap/ldap"
)

func main() {
 	tlsConfig := &tls.Config{InsecureSkipVerify: false}
	_, _ = ldap.DialTLS("tcp", "localhost:5555", tlsConfig)
}
$ go mod init github.com/foo/bar
go: creating new go.mod: module github.com/foo/bar
$  go build bla.go
go: finding gopkg.in/asn1-ber.v1 v1.3.1
build command-line-arguments: cannot load gopkg.in/asn1-ber.v1: cannot find module providing package gopkg.in/asn1-ber.v1

This is driving me crazy as it's the only LDAP library that is working for me so far. I'm not sure how I ever got it working though....Maybe by not using modules? Even that approach no longer works.

Edited to add:

I can build my code if I use GOPATH and do go get github.com/go-ldap/ldap and then go build bla.go without running go mod. However, the trivial code above is not (of course) my real code, which has lots of dependencies and modules are a better way of managing them thango get but for now I guess I will create a Makefile that doesgo get for me.

@stefanmcshane
Copy link
Contributor

Try importing go get github.com/go-ldap/ldap/v3 and make sure to remove go get github.com/go-ldap/ldap from your go.mod

@dtenenba
Copy link

It works! Thanks.

@slingamn
Copy link

I spent some time staring at the following error messages (I was flailing around and no longer remember how they were produced exactly):

  1. gopkg.in/asn1-ber.v1: cannot find module providing package gopkg.in/asn1-ber.v1: gopkg.in/[email protected]: invalid version: go.mod has non-....v1 module path "github.com/go-asn1-ber/asn1-ber" at revision v1.4.1
  2. github.com/go-ldap/[email protected]: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v3

If you're seeing these, make sure your application code is explicitly importing github.com/go-ldap/ldap/v3, not the un-suffixed github.com/go-ldap/ldap.

@stefanmcshane stefanmcshane unpinned this issue Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants