On Thu, 15 Oct 2020, at 4:16 PM, Brian Candler wrote: > It looks like a parsing ambiguity to me. The error suggests that the > open-brace is being treated as the start of the body of the if-statement, i.e. > > if v := T { > }.F() > > Try changing it to > > if v == T{}.F(); v {} > > and you'll get a different error: "syntax error: unexpected . at end of > statement" >
It is a parsing ambiguity and is mentioned in the specification towards the end of https://golang.org/ref/spec#Composite_literals -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/f9b1019b-5294-42f1-9177-dc72b7373e27%40www.fastmail.com.