up
This commit is contained in:
18
main.go
18
main.go
@@ -39,9 +39,7 @@ Flags:
|
||||
var (
|
||||
skipExtensionFlags stringSlice
|
||||
ignorePatterns stringSlice
|
||||
filesFlags stringSlice
|
||||
spdx spdxFlag
|
||||
fileList []string
|
||||
|
||||
holder = flag.String("c", "Avroid, Ltd.", "copyright holder")
|
||||
license = flag.String("l", "commercial", "license type: commercial, apache, bsd, mit, mpl")
|
||||
@@ -58,7 +56,6 @@ func init() {
|
||||
}
|
||||
flag.Var(&skipExtensionFlags, "skip", "[deprecated: see -ignore] file extensions to skip, for example: -skip rb -skip go")
|
||||
flag.Var(&ignorePatterns, "ignore", "file patterns to ignore, for example: -ignore **/*.go -ignore vendor/**")
|
||||
flag.Var(&filesFlags, "files", "list of files to include, for example: -files 'src/main.c src/header.h'")
|
||||
flag.Var(&spdx, "s", "Include SPDX identifier in license header. Set -s=only to only include SPDX identifier.")
|
||||
}
|
||||
|
||||
@@ -115,14 +112,6 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// convert string of files to list of files
|
||||
for _, l := range fileList {
|
||||
files := strings.Fields(l)
|
||||
for _, file := range files {
|
||||
fileList = append(fileList, file)
|
||||
}
|
||||
}
|
||||
|
||||
// map legacy license values
|
||||
if t, ok := legacyLicenseTypes[*license]; ok {
|
||||
*license = t
|
||||
@@ -173,11 +162,11 @@ func main() {
|
||||
return err
|
||||
}
|
||||
if !hasLicense {
|
||||
fmt.Printf("%s\n", f.path)
|
||||
fmt.Printf("%s: missing license header\n", f.path)
|
||||
return errors.New("missing license header")
|
||||
}
|
||||
if !hasCorrectAvroidLicense {
|
||||
fmt.Printf("%s\n", f.path)
|
||||
fmt.Printf("%s: incorrect year in license header\n", f.path)
|
||||
return errors.New("incorrect year in license header")
|
||||
}
|
||||
} else {
|
||||
@@ -229,9 +218,6 @@ func walk(ch chan<- *file, start string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if !fileMatches(path, fileList) {
|
||||
return nil
|
||||
}
|
||||
ch <- &file{path, fi.Mode()}
|
||||
return nil
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user