1 // Copyright 2021 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package p 6 7 func _() { 8 a, b, b /* ERROR "b repeated on left side of :=" */ := 1, 2, 3 9 _ = a 10 _ = b 11 } 12 13 func _() { 14 a, _, _ := 1, 2, 3 // multiple _'s ok 15 _ = a 16 } 17 18 func _() { 19 var b int 20 a, b, b /* ERROR "b repeated on left side of :=" */ := 1, 2, 3 21 _ = a 22 _ = b 23 } 24 25 func _() { 26 var a []int 27 a /* ERRORx `non-name .* on left side of :=` */ [0], b := 1, 2 28 _ = a 29 _ = b 30 } 31 32 func _() { 33 var a int 34 a, a /* ERROR "a repeated on left side of :=" */ := 1, 2 35 _ = a 36 } 37 38 func _() { 39 var a, b int 40 a, b := /* ERROR "no new variables on left side of :=" */ 1, 2 41 _ = a 42 _ = b 43 } 44