Skip to content

Commit

Permalink
fix: handle fs.Parse error
Browse files Browse the repository at this point in the history
  • Loading branch information
hhsnopek committed Nov 26, 2022
1 parent 42e1e81 commit 1a818d5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ func newConfig(args []string) (*config, error) {

fs := flag.NewFlagSet("ryku", flag.PanicOnError)
fs.SetOutput(os.Stdout)

fs.IntVar(&cfg.Port, "p", 8080, "Port to bind at")
fs.DurationVar(&cfg.ConnectionTimeout, "timeout", 60*time.Second, "Connection timeout")
fs.Parse(args)

err := fs.Parse(args)
if err != nil {
return nil, err
}

connectionTimeoutSetByFlag := false
fs.Visit(func(f *flag.Flag) {
Expand Down

0 comments on commit 1a818d5

Please sign in to comment.