Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Update go-license-detector to v3 #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johanbrandhorst
Copy link

go-license-detector v2 was depending on an old version of
gopkg.in/src-d/go-git, and unfortunately the latest version
broke compatibility unexpectedly. This made golicense
unnecessarily difficult to build in repositories which otherwise
used gopkg.in/src-d/go-git. Upgrading to v3 removes these problems.
See src-d/go-git#1262 for full context.

It also allows us to remove a whole lot of packages from go.mod
in general.

go-license-detector v2 was depending on an old version of
gopkg.in/src-d/go-git, and unfortunately the latest version
broke compatibility unexpectedly. This made golicense
unnecessarily difficult to build in repositories which otherwise
used gopkg.in/src-d/go-git. Upgrading to v3 removes these problems.
See src-d/go-git#1262 for full context.

It also allows us to remove a whole lot of packages from go.mod
in general.
@mc-a
Copy link

mc-a commented Dec 21, 2022

For anyone looking how to use this fixed version in go1.16 or later, I got the following to work:

echo 'replace github.com/mitchellh/golicense => github.com/johanbrandhorst/golicense f78e380eb4ebd9f0c69f42932d5ff4c10f5e3a76' >> go.mod
go get github.com/mitchellh/golicense@v0.2.1-0.20191219125333-f78e380eb4eb

The following by itself doesn't work:

$ go get github.com/mitchellh/golicense@f78e380eb4ebd9f0c69f42932d5ff4c10f5e3a76
go get: github.com/mitchellh/golicense@f78e380eb4ebd9f0c69f42932d5ff4c10f5e3a76: invalid version: unknown revision f78e380eb4ebd9f0c69f42932d5ff4c10f5e3a76
$
$ go get github.com/johanbrandhorst/golicense@f78e380eb4ebd9f0c69f42932d5ff4c10f5e3a76
go get: github.com/johanbrandhorst/golicense@none updating to
        github.com/johanbrandhorst/golicense@v0.2.1-0.20191219125333-f78e380eb4eb: parsing go.mod:
        module declares its path as: github.com/mitchellh/golicense
                but was required as: github.com/johanbrandhorst/golicense
$

The error is reproducible by running go get github.com/google/go-licenses@v1.4.0 before go get github.com/mitchellh/golicense in a fresh Docker image — otherwise, this workaround isn't required:

bash-4.2$ go get github.com/google/go-licenses@v1.4.0
go get: added github.com/google/go-licenses v1.4.0
bash-4.2$ go get github.com/mitchellh/golicense
# gopkg.in/src-d/go-license-detector.v2/licensedb/filer
/go-mod-cache/gopkg.in/src-d/go-license-detector.v2@v2.0.0-20180510072912-da552ecf050b/licensedb/filer/filer.go:212:19: assignment mismatch: 2 variables but filesystem.NewStorage returns 1 values
/go-mod-cache/gopkg.in/src-d/go-license-detector.v2@v2.0.0-20180510072912-da552ecf050b/licensedb/filer/filer.go:212:43: not enough arguments in call to filesystem.NewStorage
        have (sivafs.SivaFS)
        want (billy.Filesystem, cache.Object)
bash-4.2$ 

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants