I am new to go and have started playing around with A Tour of Go. I noticed one peculiarity namely that I am allowed to name a function _
but that function can not be called:
import "fmt"
type sel struct {
s string
}
func _(s string) sel {
return sel{s}
}
func main() {
fmt.Println("Hello")
_("foo") // <-- does not compile
}
If I comment the entire _("foo")
line then the program compiles.
My question is what characters are allowed in function names? Is it only alphanumeric characters or can I use $
for instance?
Are the rules for naming other things e.g. structs, interfaces etc. the same as those for functions?