diff --git a/.golangci.yaml b/.golangci.yaml index d4f3e34..09993a2 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -9,7 +9,6 @@ linters: - funlen - gochecknoglobals - gochecknoinits - - prealloc - revive - staticcheck - stylecheck diff --git a/deps/graph.go b/deps/graph.go index 60441e1..c872a51 100644 --- a/deps/graph.go +++ b/deps/graph.go @@ -186,7 +186,8 @@ func (g Graph) Resolve(todo []string) (order []string) { // Print renders this graph to a "dot" format. func (g Graph) Print() { - var names []string + names := make([]string, 0, len(g)) + for name := range g { names = append(names, name) } diff --git a/state/map.go b/state/map.go index 377ca06..3cfe441 100644 --- a/state/map.go +++ b/state/map.go @@ -140,7 +140,7 @@ func (m Map) Exclude(patterns []string) Map { match[k] = v } - var regexes []*regexp.Regexp + regexes := make([]*regexp.Regexp, 0, len(patterns)) for _, pattern := range patterns { exclude := strings.ReplaceAll(pattern, "*", ".*") diff --git a/triggers/map.go b/triggers/map.go index 03c104c..8c3e97d 100644 --- a/triggers/map.go +++ b/triggers/map.go @@ -36,8 +36,7 @@ func (tm Map) Merge(tm2 Map) { // Print renders a Map in a human-readable format. func (tm Map) Print(chroot, live bool) { - var keys []string - + keys := make([]string, 0, len(tm)) max := 0 for k := range tm { @@ -71,8 +70,7 @@ func (tm Map) Print(chroot, live bool) { // Graph generates a dependency graph. func (tm Map) Graph(chroot, live bool) (g deps.Graph) { g = make(deps.Graph) - - var names []string + names := make([]string, 0, len(tm)) for _, t := range tm { if t.Skip != nil {