This question already has an answer here:
Is it possible to change the value of os.Args
globally in a Golang program? I'm writting a library like Cobra just for fun, and internally I make use of os.Args
to parse the command-line arguments. I would like to do that to properly test the parser.
Currently what I am doing is manually changing the internal variable of my package, but that's a bad practice.
Thank you.
</div>