我的意思是像这样的方法类型
var Util util
type util struct { }
func (util)Help(v VM) {}
func (util)HelpMe(v VM) {}
func (util)HelpYou(v VM) {}
func (util)HelpEveryOne(v VM) {}
Run Code Online (Sandbox Code Playgroud)
我在二进制文件中看到了这一点.BigEndian
// LittleEndian is the little-endian implementation of ByteOrder.
var LittleEndian littleEndian
// BigEndian is the big-endian implementation of ByteOrder.
var BigEndian bigEndian
type littleEndian struct{}
Run Code Online (Sandbox Code Playgroud)
这是对方法进行分组的一种非常棘手的方法.所以问题是:为什么struct{}?为什么不只是一个int别名,有没有理由选择struct{}其他类型?