package main
type TreeCell struct {
Tabs func() *string
}
func Cell() *string {
s:= ""
return &s
}
func Table(Line *[]TreeCell) {
if Line != nil {
Num["rtt"] = Line
}
}
var (
Num map[string]*[]TreeCell
)
func main() {
Table(&[]TreeCell{
TreeCell{Tabs: Cell},
TreeCell{Tabs: Cell},
...repeat 15000 times
TreeCell{Tabs: Cell},
})
}
go build -a -v -gcflags "-N -l" -ldflags "-s -w"
Size of executable file 1,9Mb
__text 1459891 16781312
__rodata 158107 18241216
Total 1951521
if I change the func() *string
to the interface{}
type TreeCell struct {
Tabs interface{}
}
then size of executable file 32Mb
__text 1864389 16781312
__rodata 30375699 18645728
Total 32698219
Why?
Go version 1.9.2