On Fri, Apr 17, 2020 at 8:55 AM <[email protected]> wrote: > > Reading https://golang.org/ref/spec#Order_of_evaluation does not explain if > the order of evaluation in struct is defined. > > see https://play.golang.org/p/tjCrTI77UwZ > > Is that behavior guaranteed?
There is no guarantee about the order of evaluation within a composite literal in general. However, there is a guarantee that all function calls will be evaluated in left to right order in any expression, including a composite literal. So while you didn't actually say what you expect, I think that your example is guaranteed to behave the same in any Go implementation. Ian -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcUuPFV7YQ5Jhe4ZA_cMuWTHqRQopFWpjGR8S40%2Bxnuy8g%40mail.gmail.com.
