标签:continue tin return ring code fun ret flags 初始
type Comment struct { name string // 该指针为空, 初始化时才能设置为空; flags *FlagSet PostRun func(cmd *Comment, args []string) //结构中的抽象方法 } c := &Comment{"name",nil, func(cmd *Comment, args []string) { strings.Join(args," ") }} func (c *Comment) Flag() *FlagSet{ if c.flags == nil{ c.flags = NewFlagSet(c.name, ContinueOnError) } return c.flags }
标签:continue tin return ring code fun ret flags 初始
原文地址:https://www.cnblogs.com/ruili07/p/11002101.html