有关详细信息,请参阅 Go FAQ 中的 Should I define methods on values or pointers?。
示例:
type S struct{ } func (s *S) fun() {} func (s S) fun2() {}