Skip to content

Commit bb04aff

Browse files
thockinwcn3
authored andcommitted
Make the dummy dep on licenses dir stronger
Without an actual code-level dependency, `go mod vendor` will elide the licenses directory, which is where the actual DB files are stored. Without those, it's not very useful to vendor this lib.
1 parent 148b633 commit bb04aff

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

file_system_resources.go

+6
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@ import (
2121
"path/filepath"
2222
"runtime"
2323
"strings"
24+
25+
"github.com/google/licenseclassifier/licenses"
2426
)
2527

28+
// forceDepOnLicenses is used to force a package dependency on the licenses
29+
// dir, which includes the LicenseArchive and ForbiddenLicenseArchive files.
30+
type forceDepOnLicenses licenses.Dummy
31+
2632
const (
2733
// LicenseDirectory is the directory where the prototype licenses are kept.
2834
LicenseDirectory = "src/github.com/google/licenseclassifier/licenses"

licenses/dummy.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
// +build tools
2-
1+
// Package dummy is a placeholder. This allows consumers of licenseclassifier
2+
// to use Go modules and vendoring and still find in the licenses.db file.
33
package licenses
44

5-
// Placeholder, allows others to pull in the licenses.db file via go.mod.
5+
// Dummy is a pointless type which is used to satisfy Go's dependency-tracking
6+
// to include this directory.
7+
type Dummy struct{}

0 commit comments

Comments
 (0)