Trim whitespace from Addr.String()

If the address has no label, there's extra whitespace at the end.
This commit is contained in:
Dan Williams 2015-10-15 08:26:22 -05:00
parent 8e810149a2
commit b8bd116f5e

View File

@ -15,7 +15,7 @@ type Addr struct {
// String returns $ip/$netmask $label // String returns $ip/$netmask $label
func (a Addr) String() string { func (a Addr) String() string {
return fmt.Sprintf("%s %s", a.IPNet, a.Label) return strings.TrimSpace(fmt.Sprintf("%s %s", a.IPNet, a.Label))
} }
// ParseAddr parses the string representation of an address in the // ParseAddr parses the string representation of an address in the