Skip to content

Commit

Permalink
Enable and appease the prealloc linter
Browse files Browse the repository at this point in the history
  • Loading branch information
silkeh committed Sep 1, 2023
1 parent 806b126 commit 2d7aa17
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ linters:
- funlen
- gochecknoglobals
- gochecknoinits
- prealloc
- revive
- staticcheck
- stylecheck
Expand Down
3 changes: 2 additions & 1 deletion deps/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion state/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, "*", ".*")
Expand Down
6 changes: 2 additions & 4 deletions triggers/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 2d7aa17

Please sign in to comment.