来自规范(“声明和范围”):
The scope of an identifier denoting a constant, type, variable, or function (but not method) declared at top level (outside any function) is the package block.
我想这意味着标识符的范围表示方法而不是包 block 。
那又是什么呢?我没有在规范中找到任何信息。
最佳答案
方法名称没有作用域。它们必须始终由值或类型限定。
关于go - Go 中方法的作用域是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54300383/