Skip to content

Commit

Permalink
flag: Do not accept positional arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
awelzel committed Mar 21, 2022
1 parent be61cb5 commit e382b9c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"log"
"net"
"net/http"
"os"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -612,6 +613,13 @@ var (

func main() {
flag.Parse()

if flag.NArg() > 0 {
fmt.Fprintf(os.Stderr, "Unexpected positional arguments: %q\n", flag.Args())
flag.PrintDefaults()
os.Exit(1)
}

if *showVersion {
fmt.Printf("%s\n", version)
return
Expand Down

0 comments on commit e382b9c

Please sign in to comment.