type Node struct {
Stat *Stat
}
type Stat struct {
StatInfo []string
}
Run Code Online (Sandbox Code Playgroud)
然后
node := new(Node)
node.Stat.Statinfo=strings.Split(somestr," ")
Run Code Online (Sandbox Code Playgroud)
结果是:
恐慌:运行时错误:无效的内存地址或零指针取消引用
go ×1