-
Notifications
You must be signed in to change notification settings - Fork 76
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
Trying to vendor go-licenses, which uses this, fails because the license DB is not vendored. #27
Comments
The licenseclassifier itself was fixed with this commit The go-licenses package needs to be updated to get this change; I've sent a pull request to get this resolved. |
Does that work with vendoring? I thought vendoring would exclude a package
that was not reachable from the main package.
Indeed:
```
$ cat main.go
package main
import "github.com/google/licenseclassifier"
func main() {
x := licenseclassifier.License{}
_ = x
}
$ go mod init example.com/foo
go: creating new go.mod: module example.com/foo
go: to add module requirements and sums:
go mod tidy
$ go mod tidy
go: finding module for package github.com/google/licenseclassifier
go: found github.com/google/licenseclassifier in
github.com/google/licenseclassifier v0.0.0-20210324170212-2c2d728dc0d7
$ go mod vendor
$ find vendor/github.com/google/licenseclassifier/ -type d
vendor/github.com/google/licenseclassifier/
vendor/github.com/google/licenseclassifier/stringclassifier
vendor/github.com/google/licenseclassifier/stringclassifier/searchset
vendor/
github.com/google/licenseclassifier/stringclassifier/searchset/tokenizer
vendor/github.com/google/licenseclassifier/stringclassifier/internal
vendor/github.com/google/licenseclassifier/stringclassifier/internal/pq
vendor/github.com/google/licenseclassifier/internal
vendor/github.com/google/licenseclassifier/internal/sets
```
Empirically you need that dummy.go to not have a build tag and to export
some symbol which is used by the rest of the lib. I tried it by mocking
up github.com/thockin/vendortest
```
$ cat licenses/dummy.go
// Placeholder, allows others to pull in the licenses.db file via go.mod.
package licenses
var Dummy bool
$ cat top.go
package vendortest
import "github.com/thockin/vendortest/licenses"
type Top struct{}
var Dummy = licenses.Dummy
```
Probably using a type definition and an unexported alias would be even less
impactful?
…On Wed, Mar 24, 2021 at 10:24 AM Bill Neubauer ***@***.***> wrote:
The licenseclassifier itself was fixed with this commit
<df6aa8a>
The go-licenses package needs to be updated to get this change; I've sent a
pull request <google/go-licenses#57> to get this
resolved.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKWAVD2EYNY5XLW7NGI7DLTFIN6NANCNFSM4ZPTENUQ>
.
|
See #32 for a change to this lib, which (when updated in go-licenses) should support being vendored. |
@thockin Looks like this issue can be closed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see how this is trying to be very clever and find the license DB in its own source code path.
This totally breaks down in the face of Go's vendoring, which elides directories that do not have linked Go code in them.
So....ideas? Wouldn't it be better to embed the DB into the binary and make it self contained?
The text was updated successfully, but these errors were encountered: