I'm writing a program that takes normal flags and a single "non-flag" argument, like this:
my-prog -level 1 map.txt
To process map.txt
I use flag.Args()[:1]
, but if you pass that to functions that takes a string, this compiler error appears:
cannot use flag.Args()[:1] (type []string) as type string in assignment
How can I convert flag.Args()[:1]
to a string?