Skip to content

Instantly share code, notes, and snippets.

@kylelemons
Created July 13, 2011 22:10
Show Gist options
  • Save kylelemons/1081451 to your computer and use it in GitHub Desktop.
Save kylelemons/1081451 to your computer and use it in GitHub Desktop.
Possible compiler bug for a literal slice type in an if statement
$ 6g slice.go && sl -o slice slice.6
slice.go:11: syntax error: unexpected }, expecting := or = or comma
$ 6g -V
6g version weekly.2011-07-07 9100+
package main
type Slice []int
func main() {
a := Slice{1,2} // ok
if got := a; true { // ok
}
got := Slice{1,2} // ok
if got := Slice{1,2}; true { // bad
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment