Richard Bucker

golang: os.Args[] vs flag.Args()

Posted at — Apr 30, 2015

os.Args[] and flag.Args() are not the same thing. I know I’m stating the obvious, however, I made the same mistake three times this morning and as silly and obvious as it is… I have to call it out.os.Args[] includes arg[0] which is the executable path+name. That means that flag.Args() is also going to have one less item.