Refer to constant or package level variable instead of function level variable
问题 package main import "fmt" const name = "Yosua" // or var name string = "James" func main() { name := "Jobs" fmt.Println(name) } How to refer to the constant and not the the function level variable? 回答1: You can't. While the local variable name is in scope, the name name denotes the local variable. And there is no "qualifier" to refer to top-level identifiers. Spec: Declarations and scope: An identifier declared in a block may be redeclared in an inner block. While the identifier of the inner