Skip to content

Commit

Permalink
Add /v2 to module and imports (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
damemi authored Jun 27, 2024
1 parent 706b9c6 commit d018223
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion check.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/google/go-licenses
module github.com/google/go-licenses/v2

go 1.19

Expand Down
2 changes: 1 addition & 1 deletion internal/third_party/pkgsite/source/meta-tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions internal/third_party/pkgsite/source/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions internal/third_party/pkgsite/stdlib/stdlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion licenses/library.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
28 changes: 14 additions & 14 deletions licenses/library_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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"],
}
Expand All @@ -85,55 +85,55 @@ 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"],
},
},
},
{
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"],
},
},
},
{
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"],
},
Expand Down
4 changes: 2 additions & 2 deletions licenses/testdata/direct/direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
3 changes: 2 additions & 1 deletion licenses/testdata/tags/tags.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build tags
// +build tags

// Copyright 2019 Google Inc. All Rights Reserved.
Expand All @@ -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"
)
4 changes: 2 additions & 2 deletions licenses/testdata/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion licenses/testdata/testlib/testlib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
4 changes: 2 additions & 2 deletions report.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion save.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit d018223

Please sign in to comment.