If you want to mix flags and "unflagged" arguments, like your integer, see the flag package.
"After parsing, the arguments following the flags are available as the slice flag.Args or individually as flag.Arg(i). The arguments are indexed from 0 through flag.NArg-1." https://pkg.go.dev/flag Your request is a little confusing because you have called what looks like a program, instead by the name "function". A program always contains the main() function, and typically many other functions as well. A program is executed on the command line in the way that you illustrated: "$ ./your_program " -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/e36311aa-f4d1-4699-bcad-22e5e0c07c28n%40googlegroups.com.