You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* allow to configure the check command
* update linter version + fix new lint issues
* update readme + change flags for consistency
* Don't validate the license names upfront
* simplify the interface
* add extra usage documentation
* add support for unknown licenses
* move global usage comment
To learn more about package argument, run `go help packages`.
230
+
Supported license types:
231
+
* See `forbidden` list: [github.com/google/licenseclassifier](https://github.com/google/licenseclassifier/blob/e6a9bb99b5a6f71d5a34336b8245e305f5430f99/license_type.go#L341)
232
+
* See `notice` list: [github.com/google/licenseclassifier](https://github.com/google/licenseclassifier/blob/e6a9bb99b5a6f71d5a34336b8245e305f5430f99/license_type.go#L249)
233
+
* See `permissive` list: [github.com/google/licenseclassifier](https://github.com/google/licenseclassifier/blob/e6a9bb99b5a6f71d5a34336b8245e305f5430f99/license_type.go#L321)
234
+
* See `reciprocal` list: [github.com/google/licenseclassifier](https://github.com/google/licenseclassifier/blob/e6a9bb99b5a6f71d5a34336b8245e305f5430f99/license_type.go#L225)
235
+
* See `restricted` list: [github.com/google/licenseclassifier](https://github.com/google/licenseclassifier/blob/e6a9bb99b5a6f71d5a34336b8245e305f5430f99/license_type.go#L185)
236
+
* See `unencumbered` list: [github.com/google/licenseclassifier](https://github.com/google/licenseclassifier/blob/e6a9bb99b5a6f71d5a34336b8245e305f5430f99/license_type.go#L324)
237
+
*`unknown`
214
238
215
-
To learn more about go-licenses usages, run `go-licenses help`.
Copy file name to clipboardExpand all lines: check.go
+110-3Lines changed: 110 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -16,29 +16,57 @@ package main
16
16
17
17
import (
18
18
"context"
19
+
"errors"
19
20
"fmt"
20
21
"os"
22
+
"strings"
21
23
22
24
"github.com/google/go-licenses/licenses"
23
25
"github.com/spf13/cobra"
26
+
"golang.org/x/text/cases"
27
+
"golang.org/x/text/language"
24
28
)
25
29
26
30
var (
27
-
checkHelp="Checks whether licenses for a package are not Forbidden."
31
+
checkHelp="Checks whether licenses for a package are not allowed."
28
32
checkCmd=&cobra.Command{
29
33
Use: "check <package> [package...]",
30
34
Short: checkHelp,
31
35
Long: checkHelp+packageHelp,
32
36
Args: cobra.MinimumNArgs(1),
33
37
RunE: checkMain,
34
38
}
39
+
40
+
allowedLicenses []string
41
+
disallowedTypes []string
35
42
)
36
43
37
44
funcinit() {
45
+
checkCmd.Flags().StringSliceVar(&allowedLicenses, "allowed_licenses", []string{}, "list of allowed license names, can't be used in combination with disallowed_types")
46
+
checkCmd.Flags().StringSliceVar(&disallowedTypes, "disallowed_types", []string{}, "list of disallowed license types, can't be used in combination with allowed_licenses (default: forbidden, unknown)")
0 commit comments