Golang1.17源码分析之struct-004
源代码地址:reflect/type.go
数据结构:
// A StructField describes a single field in a struct.
type StructField struct {
	// Name is the field name.
	Name string
	// PkgPath is the package path that qualifies a lower case (unexported)
	// field name. It is empty for upper case (exported) field names.
	// See https://golang.org/ref/spec#Uniqueness_of_identifiers
	PkgPath string
	Type      Type      // field type
	Tag       StructTag // field tag string
	Offset    uintptr   // offset within struct, in bytes
	Index     []int     // index sequence for Type.FieldByIndex
	Anonymous bool      // is an embedded field
}
 
结构体内存对齐:根据成员的对其值,取最大的。然后最终结果要是对其边界的倍数,如果不够就会补全
int8 => 1 btye int16 => 2 byte










