go-consistent icon indicating copy to clipboard operation
go-consistent copied to clipboard

extend empty slice

Open sentriz opened this issue 4 years ago • 1 comments

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

sentriz avatar Apr 22 '20 01:04 sentriz

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.

quasilyte avatar Dec 17 '21 09:12 quasilyte