I'm currently writing my first small tool in Go and I ran into the problem that no matter what I do, one command line argument is getting ignored.
mainFile := flag.String("input", "./generator.ini", "the input file")
outputFile := flag.String("foo", "Default directory foo bar blablabla", "the output directory")
fmt.Println("Param: ", *outputFile)
outputDir := filepath.Clean(*outputFile)
flag.Parse()
fmt.Println("Outputdir ", outputDir)
fmt.Println("Mainfile ", *mainFile)
So the thing is that outputFile is always the default value no matter how I call the programm.
.\generator.exe -input=D:\entwicklung\GoLang\src\github.com\Abenstex\CodeGenerator\generator\main.cfg -out=D:\entwicklung\test
It absolutely does not matter if -out comes before -input or not. The value of output is always the default whereas the input value is always correctly set. I'm really at a loss here.