Skip to content

Commit

Permalink
Bump makezero to 1.1.0
Browse files Browse the repository at this point in the history
Now includes support for multiple makes per line
  • Loading branch information
ashanbrown committed Jan 16, 2022
1 parent da91922 commit 4ddbcd8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/OpenPeeDeeP/depguard v1.0.1
github.com/alexkohler/prealloc v1.0.0
github.com/ashanbrown/forbidigo v1.2.0
github.com/ashanbrown/makezero v0.0.0-20210520155254-b6261585ddde
github.com/ashanbrown/makezero v1.1.0
github.com/bkielbasa/cyclop v1.2.0
github.com/bombsimon/wsl/v3 v3.3.0
github.com/charithe/durationcheck v0.0.7
Expand Down
2 changes: 2 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions test/testdata/makezero.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ func Makezero() []int {
return append(x, 1) // ERROR "append to slice `x` with non-zero initialized length"
}

func MakezeroMultiple() []int {
x, y := make([]int, math.MaxInt8), make([]int, math.MaxInt8)
return append(x, // ERROR "append to slice `x` with non-zero initialized length"
append(y, 1)...) // ERROR "append to slice `y` with non-zero initialized length"
}

func MakezeroNolint() []int {
x := make([]int, math.MaxInt8)
return append(x, 1) //nolint:makezero // ok that we're appending to an uninitialized slice
Expand Down

0 comments on commit 4ddbcd8

Please sign in to comment.