github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/structlayout/layout.go (about) 1 package structlayout 2 3 import "fmt" 4 5 type Field struct { 6 Name string `json:"name"` 7 Type string `json:"type"` 8 Start int64 `json:"start"` 9 End int64 `json:"end"` 10 Size int64 `json:"size"` 11 Align int64 `json:"align"` 12 IsPadding bool `json:"is_padding"` 13 } 14 15 func (f Field) String() string { 16 if f.IsPadding { 17 return fmt.Sprintf("%s: %d-%d (size %d, align %d)", 18 "padding", f.Start, f.End, f.Size, f.Align) 19 } 20 return fmt.Sprintf("%s %s: %d-%d (size %d, align %d)", 21 f.Name, f.Type, f.Start, f.End, f.Size, f.Align) 22 }