From f5dc92daa8d70263d2c54e73e320da6204d632e7 Mon Sep 17 00:00:00 2001 From: Camilo Aguilar Date: Tue, 8 Dec 2015 19:05:15 -0500 Subject: [PATCH] Addresses Go lint suggestions --- command/agent/config.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/command/agent/config.go b/command/agent/config.go index 5f0bfdf78..bc295ff06 100644 --- a/command/agent/config.go +++ b/command/agent/config.go @@ -257,7 +257,7 @@ func DefaultConfig() *Config { } } -// GetListener can be used to get a new listener using a custom bind address. +// Listener can be used to get a new listener using a custom bind address. // If the bind provided address is empty, the BindAddr is used instead. func (c *Config) Listener(proto, addr string, port int) (net.Listener, error) { if addr == "" { @@ -267,8 +267,8 @@ func (c *Config) Listener(proto, addr string, port int) (net.Listener, error) { } // Merge merges two configurations. -func (a *Config) Merge(b *Config) *Config { - var result Config = *a +func (c *Config) Merge(b *Config) *Config { + result := *c if b.Region != "" { result.Region = b.Region @@ -371,7 +371,7 @@ func (a *Config) Merge(b *Config) *Config { // Merge is used to merge two server configs together func (a *ServerConfig) Merge(b *ServerConfig) *ServerConfig { - var result ServerConfig = *a + result := *a if b.Enabled { result.Enabled = true @@ -400,7 +400,7 @@ func (a *ServerConfig) Merge(b *ServerConfig) *ServerConfig { // Merge is used to merge two client configs together func (a *ClientConfig) Merge(b *ClientConfig) *ClientConfig { - var result ClientConfig = *a + result := *a if b.Enabled { result.Enabled = true @@ -448,7 +448,7 @@ func (a *ClientConfig) Merge(b *ClientConfig) *ClientConfig { // Merge is used to merge two telemetry configs together func (a *Telemetry) Merge(b *Telemetry) *Telemetry { - var result Telemetry = *a + result := *a if b.StatsiteAddr != "" { result.StatsiteAddr = b.StatsiteAddr @@ -464,7 +464,7 @@ func (a *Telemetry) Merge(b *Telemetry) *Telemetry { // Merge is used to merge two port configurations. func (a *Ports) Merge(b *Ports) *Ports { - var result Ports = *a + result := *a if b.HTTP != 0 { result.HTTP = b.HTTP @@ -480,7 +480,7 @@ func (a *Ports) Merge(b *Ports) *Ports { // Merge is used to merge two address configs together. func (a *Addresses) Merge(b *Addresses) *Addresses { - var result Addresses = *a + result := *a if b.HTTP != "" { result.HTTP = b.HTTP @@ -496,7 +496,7 @@ func (a *Addresses) Merge(b *Addresses) *Addresses { // Merge merges two advertise addrs configs together. func (a *AdvertiseAddrs) Merge(b *AdvertiseAddrs) *AdvertiseAddrs { - var result AdvertiseAddrs = *a + result := *a if b.RPC != "" { result.RPC = b.RPC @@ -509,7 +509,7 @@ func (a *AdvertiseAddrs) Merge(b *AdvertiseAddrs) *AdvertiseAddrs { // Merge merges two Atlas configurations together. func (a *AtlasConfig) Merge(b *AtlasConfig) *AtlasConfig { - var result AtlasConfig = *a + result := *a if b.Infrastructure != "" { result.Infrastructure = b.Infrastructure @@ -536,9 +536,8 @@ func LoadConfig(path string) (*Config, error) { if fi.IsDir() { return LoadConfigDir(path) - } else { - return LoadConfigFile(path) } + return LoadConfigFile(path) } // LoadConfigString is used to parse a config string