-
Notifications
You must be signed in to change notification settings - Fork 231
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
licensetool: embed license DB, update for more modules #3665
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ import ( | |
"bytes" | ||
"context" | ||
"debug/buildinfo" | ||
"embed" | ||
"encoding/json" | ||
"fmt" | ||
"io" | ||
|
@@ -35,6 +36,9 @@ import ( | |
"sigs.k8s.io/yaml" | ||
) | ||
|
||
//go:embed modules/* | ||
var modulesFS embed.FS | ||
|
||
func main() { | ||
rootCmd := buildRootCommand() | ||
|
||
|
@@ -125,7 +129,14 @@ func RunLicenseScan(ctx context.Context, opts RunLicenseScanOptions) error { | |
modules = append(modules, module) | ||
|
||
p := filepath.Join("modules", module.Name, module.Version+".yaml") | ||
b, err := ioutil.ReadFile(p) | ||
b, err := os.ReadFile(p) | ||
if err != nil && os.IsNotExist(err) { | ||
b2, err2 := modulesFS.ReadFile(p) | ||
if err2 == nil { | ||
b = b2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so this will ensure license info from the moduleFS gets written back to local FS. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, ish. The workflow I use is to run it against the binary. Then I search for |
||
err = err2 | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. err2 != nil is being ignored and I believe that's intentional because err is what we care about in that case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it is deliberate (I think), but I think I'll take a second look and maybe log a |
||
} | ||
if err != nil { | ||
if os.IsNotExist(err) { | ||
if err := os.MkdirAll(filepath.Dir(p), 0755); err != nil { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/bitbucket.org/creachadair/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/cloud.google.com/go/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/cloud.google.com/go/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/cloud.google.com/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/Azure/go-autorest/autorest/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/Azure/go-autorest/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/GoogleCloudPlatform/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/GoogleContainerTools/kpt/porch/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/GoogleContainerTools/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/MakeNowJust/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/apparentlymart/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# https://pkg.go.dev/github.com/apparentlymart/go-textseg/[email protected] | ||
license: Apache-2.0,MIT,Unicode-DFS-2016 | ||
licenseURLs: | ||
- https://raw.githubusercontent.com/apparentlymart/go-textseg/master/LICENSE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/cenkalti/[email protected]+incompatible | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/chai2010/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/emicklei/go-restful/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/evanphx/json-patch/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/fatih/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/golang-jwt/jwt/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/golang/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/golang/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/google/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/google/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/google/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/googleapis/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/googleapis/gax-go/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/googleapis/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/grpc-ecosystem/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/hcl/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/terraform-provider-google-beta@(devel) | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/hashicorp/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/mattn/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/mattn/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/mitchellh/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/mitchellh/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/mitchellh/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/mitchellh/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/mitchellh/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/nasa9084/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/sirupsen/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/spf13/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/spyzhov/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/terraform-providers/[email protected] | ||
license: MPL-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/vmihailenco/msgpack/[email protected] | ||
license: BSD-2-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/vmihailenco/[email protected] | ||
license: BSD-2-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/github.com/zclconf/[email protected] | ||
license: MIT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/golang.org/x/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/golang.org/x/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/golang.org/x/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/golang.org/x/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/golang.org/x/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/golang.org/x/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/golang.org/x/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/google.golang.org/[email protected] | ||
license: BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/google.golang.org/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/google.golang.org/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/klog/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/sigs.k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/sigs.k8s.io/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/sigs.k8s.io/[email protected] | ||
license: Apache-2.0, BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/sigs.k8s.io/[email protected] | ||
license: Apache-2.0, BSD-3-Clause |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/sigs.k8s.io/structured-merge-diff/[email protected] | ||
license: Apache-2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://pkg.go.dev/sigs.k8s.io/structured-merge-diff/[email protected] | ||
license: Apache-2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting: eventually we can have it in its own Go package that will make this DB portable across all the tools :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope so :-)