Types Properties

Two types are identical or different. A defined type is always different from any other type. Otherwise, two types are identical if their underlying type literals are structurally equivalent; i.e. they have the same literal structure and the corresponding components have identical types.

The following types are identical:


A0, A1, and []string
A2 and struct{ a, b int }
A3 and int
A4, func(int, float64) *[]string, and A5

B0 and C0
[]int and []int
struct{ a, b *T5 } and struct{ a, b *T5 }
func(x int, y float64) *[]string, func(int, float64) (result *[]string), and A5
                        

B0 and B1 are different because they are new types created by different type definitions; func (int, float64) *B0 and func (x int, y float64) *[]string are different because B0 is different from *[]string.

types_properties.go