mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-04-06 21:48:08 -05:00
Reject positional CLI arguments
My team spent a bit of time debugging a mistake where we forgot to redirect output to a file. The command looked valid and exited 0. This change causes the program to fail if provided with any positional arguments.
This commit is contained in:
parent
385fac0ced
commit
63c2422f96
@ -26,6 +26,11 @@ func init() {
|
|||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if flag.NArg() != 0 {
|
||||||
|
fmt.Println("go-junit-report does not accept positional arguments")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
// Read input
|
// Read input
|
||||||
report, err := parser.Parse(os.Stdin, packageName)
|
report, err := parser.Parse(os.Stdin, packageName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user