diff --git a/check.go b/check.go index 4c00125a..aef08a6a 100644 --- a/check.go +++ b/check.go @@ -21,7 +21,7 @@ import ( "os" "strings" - "github.com/google/go-licenses/licenses" + "github.com/google/go-licenses/v2/licenses" "github.com/spf13/cobra" "golang.org/x/text/cases" "golang.org/x/text/language" diff --git a/go.mod b/go.mod index b8a766d4..00b8afbe 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-licenses +module github.com/google/go-licenses/v2 go 1.19 diff --git a/internal/third_party/pkgsite/source/meta-tags.go b/internal/third_party/pkgsite/source/meta-tags.go index 1f8b2bb7..d3c9cc6e 100644 --- a/internal/third_party/pkgsite/source/meta-tags.go +++ b/internal/third_party/pkgsite/source/meta-tags.go @@ -11,7 +11,7 @@ import ( "io" "strings" - "github.com/google/go-licenses/internal/third_party/pkgsite/derrors" + "github.com/google/go-licenses/v2/internal/third_party/pkgsite/derrors" ) // This code adapted from https://go.googlesource.com/gddo/+/refs/heads/master/gosrc/gosrc.go. diff --git a/internal/third_party/pkgsite/source/source.go b/internal/third_party/pkgsite/source/source.go index c6b63cc9..b9530bde 100644 --- a/internal/third_party/pkgsite/source/source.go +++ b/internal/third_party/pkgsite/source/source.go @@ -31,9 +31,9 @@ import ( "strings" "time" - "github.com/google/go-licenses/internal/third_party/pkgsite/derrors" - "github.com/google/go-licenses/internal/third_party/pkgsite/stdlib" - "github.com/google/go-licenses/internal/third_party/pkgsite/version" + "github.com/google/go-licenses/v2/internal/third_party/pkgsite/derrors" + "github.com/google/go-licenses/v2/internal/third_party/pkgsite/stdlib" + "github.com/google/go-licenses/v2/internal/third_party/pkgsite/version" "go.opencensus.io/plugin/ochttp" "go.opencensus.io/trace" "golang.org/x/net/context/ctxhttp" diff --git a/internal/third_party/pkgsite/stdlib/stdlib.go b/internal/third_party/pkgsite/stdlib/stdlib.go index 59336996..5372e3dd 100644 --- a/internal/third_party/pkgsite/stdlib/stdlib.go +++ b/internal/third_party/pkgsite/stdlib/stdlib.go @@ -12,8 +12,8 @@ import ( "fmt" "strings" - "github.com/google/go-licenses/internal/third_party/pkgsite/derrors" - "github.com/google/go-licenses/internal/third_party/pkgsite/version" + "github.com/google/go-licenses/v2/internal/third_party/pkgsite/derrors" + "github.com/google/go-licenses/v2/internal/third_party/pkgsite/version" "golang.org/x/mod/semver" ) diff --git a/licenses/library.go b/licenses/library.go index 3deedd2c..fa59120f 100644 --- a/licenses/library.go +++ b/licenses/library.go @@ -22,7 +22,7 @@ import ( "sort" "strings" - "github.com/google/go-licenses/internal/third_party/pkgsite/source" + "github.com/google/go-licenses/v2/internal/third_party/pkgsite/source" "golang.org/x/sync/errgroup" "golang.org/x/tools/go/packages" "k8s.io/klog/v2" diff --git a/licenses/library_test.go b/licenses/library_test.go index 13af573e..da00e8ce 100644 --- a/licenses/library_test.go +++ b/licenses/library_test.go @@ -21,7 +21,7 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/google/go-licenses/internal/third_party/pkgsite/source" + "github.com/google/go-licenses/v2/internal/third_party/pkgsite/source" ) func TestLibraries(t *testing.T) { @@ -60,17 +60,17 @@ func TestLibraries(t *testing.T) { } testdataLibInfo := wantedLibInfo{ - Name: "github.com/google/go-licenses/licenses/testdata", + Name: "github.com/google/go-licenses/v2/licenses/testdata", LicenseFile: wd + "/testdata/LICENSE", Licenses: classifier.licenses["testdata/LICENSE"], } directLibInfo := wantedLibInfo{ - Name: "github.com/google/go-licenses/licenses/testdata/direct", + Name: "github.com/google/go-licenses/v2/licenses/testdata/direct", LicenseFile: wd + "/testdata/direct/LICENSE", Licenses: classifier.licenses["testdata/direct/LICENSE"], } indirectLibInfo := wantedLibInfo{ - Name: "github.com/google/go-licenses/licenses/testdata/indirect", + Name: "github.com/google/go-licenses/v2/licenses/testdata/indirect", LicenseFile: wd + "/testdata/indirect/LICENSE", Licenses: classifier.licenses["testdata/indirect/LICENSE"], } @@ -85,30 +85,30 @@ func TestLibraries(t *testing.T) { }{ { desc: "Detects direct dependency", - importPath: "github.com/google/go-licenses/licenses/testdata/direct", + importPath: "github.com/google/go-licenses/v2/licenses/testdata/direct", wantLibs: []wantedLibInfo{directLibInfo, indirectLibInfo}, }, { desc: "Detects transitive dependency", - importPath: "github.com/google/go-licenses/licenses/testdata", + importPath: "github.com/google/go-licenses/v2/licenses/testdata", wantLibs: []wantedLibInfo{testdataLibInfo, directLibInfo, indirectLibInfo}, }, { desc: "Ignores a package path", - importPath: "github.com/google/go-licenses/licenses/testdata", + importPath: "github.com/google/go-licenses/v2/licenses/testdata", ignore: []string{ - "github.com/google/go-licenses/licenses/testdata/direct", + "github.com/google/go-licenses/v2/licenses/testdata/direct", }, wantLibs: []wantedLibInfo{testdataLibInfo, indirectLibInfo}, }, { desc: "Detects the dependencies only imported in testing code", - importPath: "github.com/google/go-licenses/licenses/testdata/testlib", + importPath: "github.com/google/go-licenses/v2/licenses/testdata/testlib", includeTests: true, wantLibs: []wantedLibInfo{ indirectLibInfo, { - Name: "github.com/google/go-licenses/licenses/testdata/testlib", + Name: "github.com/google/go-licenses/v2/licenses/testdata/testlib", LicenseFile: wd + "/testdata/LICENSE", Licenses: classifier.licenses["testdata/LICENSE"], }, @@ -116,11 +116,11 @@ func TestLibraries(t *testing.T) { }, { desc: "Should not detect the dependencies only imported in testing code", - importPath: "github.com/google/go-licenses/licenses/testdata/testlib", + importPath: "github.com/google/go-licenses/v2/licenses/testdata/testlib", includeTests: false, wantLibs: []wantedLibInfo{ { - Name: "github.com/google/go-licenses/licenses/testdata/testlib", + Name: "github.com/google/go-licenses/v2/licenses/testdata/testlib", LicenseFile: wd + "/testdata/LICENSE", Licenses: classifier.licenses["testdata/LICENSE"], }, @@ -128,12 +128,12 @@ func TestLibraries(t *testing.T) { }, { desc: "Build tagged package", - importPath: "github.com/google/go-licenses/licenses/testdata/tags", + importPath: "github.com/google/go-licenses/v2/licenses/testdata/tags", goflags: "-tags=tags", wantLibs: []wantedLibInfo{ indirectLibInfo, { - Name: "github.com/google/go-licenses/licenses/testdata/tags", + Name: "github.com/google/go-licenses/v2/licenses/testdata/tags", LicenseFile: wd + "/testdata/LICENSE", Licenses: classifier.licenses["testdata/LICENSE"], }, diff --git a/licenses/testdata/direct/direct.go b/licenses/testdata/direct/direct.go index 67431885..ba6e4149 100644 --- a/licenses/testdata/direct/direct.go +++ b/licenses/testdata/direct/direct.go @@ -16,8 +16,8 @@ package direct import ( // This import should be ignored, since it's an internal dependency. - _ "github.com/google/go-licenses/licenses/testdata/direct/subpkg" + _ "github.com/google/go-licenses/v2/licenses/testdata/direct/subpkg" // This import should be detected as being a transitive dependency of whatever // imports this package. - _ "github.com/google/go-licenses/licenses/testdata/indirect" + _ "github.com/google/go-licenses/v2/licenses/testdata/indirect" ) diff --git a/licenses/testdata/tags/tags.go b/licenses/testdata/tags/tags.go index f1f63a2c..d5d8a0a6 100644 --- a/licenses/testdata/tags/tags.go +++ b/licenses/testdata/tags/tags.go @@ -1,3 +1,4 @@ +//go:build tags // +build tags // Copyright 2019 Google Inc. All Rights Reserved. @@ -19,5 +20,5 @@ package tags import ( // This import should be detected as being a transitive dependency of whatever // imports this package. - _ "github.com/google/go-licenses/licenses/testdata/indirect" + _ "github.com/google/go-licenses/v2/licenses/testdata/indirect" ) diff --git a/licenses/testdata/testdata.go b/licenses/testdata/testdata.go index 8a10307e..aa9e80da 100644 --- a/licenses/testdata/testdata.go +++ b/licenses/testdata/testdata.go @@ -19,10 +19,10 @@ import ( // package that isn't in the standard library and has a separate license // file to the one covering the Trillian repository, so that it's detected // as being an external dependency. - _ "github.com/google/go-licenses/licenses/testdata/direct" + _ "github.com/google/go-licenses/v2/licenses/testdata/direct" // This import should be ignored, since it's an internal dependency. - _ "github.com/google/go-licenses/licenses/testdata/internal" + _ "github.com/google/go-licenses/v2/licenses/testdata/internal" // This import should be ignored, since it's an standard library package. _ "strings" diff --git a/licenses/testdata/testlib/testlib_test.go b/licenses/testdata/testlib/testlib_test.go index 23fdde19..68a0904d 100644 --- a/licenses/testdata/testlib/testlib_test.go +++ b/licenses/testdata/testlib/testlib_test.go @@ -16,5 +16,5 @@ package testlib import ( // This import should be detected if includeTests set true - _ "github.com/google/go-licenses/licenses/testdata/indirect" + _ "github.com/google/go-licenses/v2/licenses/testdata/indirect" ) diff --git a/report.go b/report.go index 888be488..b145178b 100644 --- a/report.go +++ b/report.go @@ -22,8 +22,8 @@ import ( "text/template" "time" - "github.com/google/go-licenses/internal/third_party/pkgsite/source" - "github.com/google/go-licenses/licenses" + "github.com/google/go-licenses/v2/internal/third_party/pkgsite/source" + "github.com/google/go-licenses/v2/licenses" "github.com/spf13/cobra" "golang.org/x/sync/errgroup" "k8s.io/klog/v2" diff --git a/save.go b/save.go index 1faa4004..dc97e29a 100644 --- a/save.go +++ b/save.go @@ -22,7 +22,7 @@ import ( "regexp" "strings" - "github.com/google/go-licenses/licenses" + "github.com/google/go-licenses/v2/licenses" "github.com/otiai10/copy" "github.com/spf13/cobra" "k8s.io/klog/v2"