use net.JoinHostPort

pull/2330/head
Cory LaNou 2015-04-16 16:31:31 -06:00 committed by Philip O'Toole
parent 46b19a5777
commit 0d734868a8
1 changed files with 2 additions and 2 deletions

View File

@ -470,7 +470,7 @@ func (c *Collectd) ConnectionString(defaultBindAddr string) string {
type Graphite struct {
BindAddress string `toml:"bind-address"`
Port uint16 `toml:"port"`
Port int `toml:"port"`
Database string `toml:"database"`
Enabled bool `toml:"enabled"`
@ -481,7 +481,7 @@ type Graphite struct {
// ConnnectionString returns the connection string for this Graphite config in the form host:port.
func (g *Graphite) ConnectionString() string {
return fmt.Sprintf("%s:%d", g.BindAddress, g.Port)
return net.JoinHostPort(g.BindAddress, strconv.Itoa(g.Port))
}
// NameSeparatorString returns the character separating fields for Graphite data, or the default