diff --git a/rules/style.go b/rules/style.go index 8d08e40..436e307 100644 --- a/rules/style.go +++ b/rules/style.go @@ -39,6 +39,6 @@ func emptyError(m dsl.Matcher) { //doc:tags style func emptySlice(m dsl.Matcher) { m.Match(`var $name = make([]$type, 0)`, `$name := []$type{}`, `$name := make([]$type, 0, 0)`, `$name := make([]$type, 0)`). - Report(`nil slice is the preferred style`). + Report(`zero-length slice declaring nil slice is better`). Suggest(`var $name []$type`) } diff --git a/rules/testdata/style.go b/rules/testdata/style.go index e82e257..69c1703 100644 --- a/rules/testdata/style.go +++ b/rules/testdata/style.go @@ -27,7 +27,7 @@ func emptyError() { } func emptySlice() { - x := []int{} // want `\Qnil slice is the preferred style, should be: var x []int` - a := make([]int, 0, 0) // want `\Qnil slice is the preferred style, should be: var a []int` + x := []int{} // want `\QemptySlice: zero-length slice declaring nil slice is better + a := make([]int, 0, 0) // want `\QemptySlice: zero-length slice declaring nil slice is better fmt.Println(x, a) }