quasilyte / go-consistent

Source code analyzer that helps you to make your Go programs more consistent.
MIT License
334 stars 16 forks source link

extend empty slice #36

Open sentriz opened 4 years ago

sentriz commented 4 years ago

I see the empty slice section https://github.com/quasilyte/go-consistent#empty-map

does it make sense to include a var initialisation too? eg

    a := make([]int, 0)
    b := []int{}
    var c []int

https://play.golang.org/p/oI0oilKpgg7

quasilyte commented 2 years ago

Hello! Sorry for the delayed response.

The var c []int initializes nil slice, so c == nil is true, while b == nil is false. go-consistent tries to find 100% identical forms, so the code semantics do not change.