Why should I use the package "flag"

func main() {
    var wait time.Duration 
    flag.DurationVar(&wait, "graceful-timeout", time.Second * 15, "the duration for which the server gracefully wait for existing connections to finish - e.g. 15s or 1m")
    flag.Parse() 
    //...
}

What does it even mean or what does it do?

Take a look at the documentation of flag, it explains everything.

3 Likes

Very nice, didn’t know there was an entire library for parsing command line arguments :grinning:

Wow! Thanks for that!