struct {a int; b int}和struct {b int; a int}有什么区别?

What is the difference between these two structs other than that they aren't considered equivalent?

package main
func main() {}
func f1(s struct{a int;b int}) { f2(s) }
func f2(s struct{b int;a int}) {}

$ go run a.go 
# command-line-arguments
./a.go:3: cannot use s (type struct { a int; b int }) as type struct { b int; a int } in argument to f2

Note: this does compile:

package main
func main() {}
func f1(s struct{a int;b int}) { f2(s) }
func f2(s struct{a int;b int}) {}

"The order of structs' fields is important on the low level" How?

This will impact the reflection, like func (v Value) Field(i int) Value:

Field returns the i'th field of the struct v

The first field 'a' in the first structure wouldn't be the same first in the second structure.
That also will influence serialization with marshaler methods (encoding package).

From the spec:

Two struct types are identical if they have the same sequence of fields, and if corresponding fields have the same names, and identical types, and identical tags. Two anonymous fields are considered to have the same name. Lower-case field names from different packages are always different.

The order of structs' fields is important on the low level, so two structs with different sequence of fields cannot be safely considered equivalent.

Properties of types and values

Type identity

Two struct types are identical if they have the same sequence of fields, and if corresponding fields have the same names, and identical types, and identical tags.

The corresponding field names differ:

s struct{a int;b int}

versus

s struct{b int;a int}