types/flagtype: fix bug showing the default port value (shown in --help)
parent
62d941dc26
commit
691f1d5c1d
|
@ -21,7 +21,12 @@ func PortValue(dst *uint16, defaultPort uint16) flag.Value {
|
||||||
return portValue{dst}
|
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 {
|
func (p portValue) Set(v string) error {
|
||||||
if v == "" {
|
if v == "" {
|
||||||
return errors.New("can't be the empty string")
|
return errors.New("can't be the empty string")
|
||||||
|
|
Loading…
Reference in New Issue