2022-07-15 15:32:10 +02:00
|
|
|
//golangcitest:args -Emakezero
|
2020-12-05 07:37:37 -08:00
|
|
|
package testdata
|
|
|
|
|
2021-02-14 19:11:38 +01:00
|
|
|
import "math"
|
|
|
|
|
2020-12-05 07:37:37 -08:00
|
|
|
func Makezero() []int {
|
2021-02-14 19:11:38 +01:00
|
|
|
x := make([]int, math.MaxInt8)
|
2022-08-20 18:53:45 +02:00
|
|
|
return append(x, 1) // want "append to slice `x` with non-zero initialized length"
|
2020-12-05 07:37:37 -08:00
|
|
|
}
|
|
|
|
|
2022-01-16 13:48:49 -08:00
|
|
|
func MakezeroMultiple() []int {
|
|
|
|
x, y := make([]int, math.MaxInt8), make([]int, math.MaxInt8)
|
2022-08-20 18:53:45 +02:00
|
|
|
return append(x, // want "append to slice `x` with non-zero initialized length"
|
|
|
|
append(y, 1)...) // want "append to slice `y` with non-zero initialized length"
|
2022-01-16 13:48:49 -08:00
|
|
|
}
|
|
|
|
|
2020-12-05 07:37:37 -08:00
|
|
|
func MakezeroNolint() []int {
|
2021-02-14 19:11:38 +01:00
|
|
|
x := make([]int, math.MaxInt8)
|
2020-12-05 07:37:37 -08:00
|
|
|
return append(x, 1) //nolint:makezero // ok that we're appending to an uninitialized slice
|
|
|
|
}
|