From da89464a63a7c181e928a68f4ac392bd841a00b2 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sat, 20 Oct 2018 17:22:51 +0200 Subject: compiler: compare slice against nil --- testdata/slice.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'testdata/slice.go') diff --git a/testdata/slice.go b/testdata/slice.go index c5e4a3308..8fcbffff1 100644 --- a/testdata/slice.go +++ b/testdata/slice.go @@ -4,6 +4,7 @@ func main() { l := 5 foo := []int{1, 2, 4, 5} bar := make([]int, l-2, l) + println("foo is nil?", foo == nil, nil == foo) printslice("foo", foo) printslice("bar", bar) printslice("foo[1:2]", foo[1:2]) @@ -15,6 +16,7 @@ func main() { // append var grow []int + println("slice is nil?", grow == nil, nil == grow) printslice("grow", grow) grow = append(grow, 42) printslice("grow", grow) -- cgit v1.2.3