aboutsummaryrefslogtreecommitdiffstats
path: root/build/generate-go-licenses.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-08-30 08:55:25 +0200
committerGitHub <noreply@github.com>2023-08-30 06:55:25 +0000
commit5315153059529f03b06c8f25487ffcc21ae3163f (patch)
treeb5f90daf2f1916f37656369865706d95872a7ae7 /build/generate-go-licenses.go
parent815d267c8031daa19b82b291a6393a54715567c0 (diff)
downloadgitea-5315153059529f03b06c8f25487ffcc21ae3163f.tar.gz
gitea-5315153059529f03b06c8f25487ffcc21ae3163f.zip
Use `Set[Type]` instead of `map[Type]bool/struct{}`. (#26804)
Diffstat (limited to 'build/generate-go-licenses.go')
-rw-r--r--build/generate-go-licenses.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/build/generate-go-licenses.go b/build/generate-go-licenses.go
index c3b40c226f..84ba39025c 100644
--- a/build/generate-go-licenses.go
+++ b/build/generate-go-licenses.go
@@ -15,6 +15,8 @@ import (
"regexp"
"sort"
"strings"
+
+ "code.gitea.io/gitea/modules/container"
)
// regexp is based on go-license, excluding README and NOTICE
@@ -55,20 +57,14 @@ func main() {
// yml
//
// It could be removed once we have a better regex.
- excludedExt := map[string]bool{
- ".gitignore": true,
- ".go": true,
- ".mod": true,
- ".sum": true,
- ".toml": true,
- ".yml": true,
- }
+ excludedExt := container.SetOf(".gitignore", ".go", ".mod", ".sum", ".toml", ".yml")
+
var paths []string
err := filepath.WalkDir(base, func(path string, entry fs.DirEntry, err error) error {
if err != nil {
return err
}
- if entry.IsDir() || !licenseRe.MatchString(entry.Name()) || excludedExt[filepath.Ext(entry.Name())] {
+ if entry.IsDir() || !licenseRe.MatchString(entry.Name()) || excludedExt.Contains(filepath.Ext(entry.Name())) {
return nil
}
paths = append(paths, path)