Skip to content

Commit

Permalink
Make the dummy dep on licenses dir stronger
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thockin authored and wcn3 committed Mar 25, 2021
1 parent 148b633 commit bb04aff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions file_system_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ import (
"path/filepath"
"runtime"
"strings"

"github.com/google/licenseclassifier/licenses"
)

// forceDepOnLicenses is used to force a package dependency on the licenses
// dir, which includes the LicenseArchive and ForbiddenLicenseArchive files.
type forceDepOnLicenses licenses.Dummy

const (
// LicenseDirectory is the directory where the prototype licenses are kept.
LicenseDirectory = "src/github.com/google/licenseclassifier/licenses"
Expand Down
8 changes: 5 additions & 3 deletions licenses/dummy.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// +build tools

// Package dummy is a placeholder. This allows consumers of licenseclassifier
// to use Go modules and vendoring and still find in the licenses.db file.
package licenses

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

0 comments on commit bb04aff

Please sign in to comment.