It can infer the type, but from memory, it was decided that for improved safety explicit types should be used. There have been discussion about relaxing this in the past and it is an open proposal.
SeeĀ https://github.com/golang/go/issues/21496 On Mon, 2019-03-18 at 20:01 -0700, zhou yu wrote: > gc can not infer the type of {1, 2} of {1,2,3,4}, so you need to > indicateĀ > it's type -- 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. For more options, visit https://groups.google.com/d/optout.