From 691f1d5c1dd43de88ba590dfd3df84a77a3871cb Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 19 Oct 2020 20:18:31 -0700 Subject: [PATCH] types/flagtype: fix bug showing the default port value (shown in --help) --- types/flagtype/flagtype.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/flagtype/flagtype.go b/types/flagtype/flagtype.go index ceab09869..6b97a2902 100644 --- a/types/flagtype/flagtype.go +++ b/types/flagtype/flagtype.go @@ -21,7 +21,12 @@ func PortValue(dst *uint16, defaultPort uint16) flag.Value { return portValue{dst} } -func (p portValue) String() string { return fmt.Sprint(p.n) } +func (p portValue) String() string { + if p.n == nil { + return "" + } + return fmt.Sprint(*p.n) +} func (p portValue) Set(v string) error { if v == "" { return errors.New("can't be the empty string")