I have a function like this:
var flagvar int
func init() {
flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname")
}
I want to call it in func main()
:
func main(){
init()
}
But it does not work and told me init()
is not defined.
What's the problem?