You just have to check flag.NArg().
From https://golang.org/pkg/flag/#NArg:
NArg is the number of arguments remaining after flags have been processed.
flag.Parse()
if flag.NArg() == 0 {
flag.Usage()
os.Exit(1)
}
You just have to check flag.NArg().
From https://golang.org/pkg/flag/#NArg:
NArg is the number of arguments remaining after flags have been processed.
flag.Parse()
if flag.NArg() == 0 {
flag.Usage()
os.Exit(1)
}