diff --git a/command/command.go b/command/command.go index e291429e..0e3fad0d 100644 --- a/command/command.go +++ b/command/command.go @@ -693,8 +693,8 @@ func buildUA(ver, rev string) string { } // NewMackerelClient returns Mackerel API client for mackerel-agent -func NewMackerelClient(apibase, apikey, ver, rev string, verbose bool, disableHttpKeepAlive bool) (*mackerel.API, error) { - api, err := mackerel.NewAPI(apibase, apikey, verbose, disableHttpKeepAlive) +func NewMackerelClient(apibase, apikey, ver, rev string, verbose bool, disableHTTPKeepAlive bool) (*mackerel.API, error) { + api, err := mackerel.NewAPI(apibase, apikey, verbose, disableHTTPKeepAlive) if err != nil { return nil, err } @@ -708,7 +708,7 @@ func NewMackerelClient(apibase, apikey, ver, rev string, verbose bool, disableHt // Prepare sets up API and registers the host data to the Mackerel server. // Use returned values to call Run(). func Prepare(conf *config.Config, ameta *AgentMeta) (*App, error) { - api, err := NewMackerelClient(conf.Apibase, conf.Apikey, ameta.Version, ameta.Revision, conf.Verbose, conf.DisableHttpKeepAlive) + api, err := NewMackerelClient(conf.Apibase, conf.Apikey, ameta.Version, ameta.Revision, conf.Verbose, conf.DisableHTTPKeepAlive) if err != nil { return nil, fmt.Errorf("failed to prepare an api: %s", err.Error()) } diff --git a/commands.go b/commands.go index 069bea95..c41aa351 100644 --- a/commands.go +++ b/commands.go @@ -156,7 +156,7 @@ func doRetire(fs *flag.FlagSet, argv []string) error { return fmt.Errorf("hostID file is not found or empty") } - api, err := command.NewMackerelClient(conf.Apibase, conf.Apikey, version, gitcommit, conf.Verbose, conf.DisableHttpKeepAlive) + api, err := command.NewMackerelClient(conf.Apibase, conf.Apikey, version, gitcommit, conf.Verbose, conf.DisableHTTPKeepAlive) if err != nil { return fmt.Errorf("faild to create api client: %s", err) } diff --git a/config/config.go b/config/config.go index d1190329..27c85e73 100644 --- a/config/config.go +++ b/config/config.go @@ -102,7 +102,7 @@ type Config struct { Verbose bool Silent bool Diagnostic bool `toml:"diagnostic"` - DisableHttpKeepAlive bool `toml:"disable_http_keep_alive"` + DisableHTTPKeepAlive bool `toml:"disable_http_keep_alive"` DisplayName string `toml:"display_name"` HostStatus HostStatus `toml:"host_status" conf:"parent"` Disks Disks `toml:"disks" conf:"parent"` @@ -448,8 +448,8 @@ func LoadConfig(conffile string) (*Config, error) { if !config.Diagnostic { config.Diagnostic = DefaultConfig.Diagnostic } - if !config.DisableHttpKeepAlive { - config.DisableHttpKeepAlive = DefaultConfig.DisableHttpKeepAlive + if !config.DisableHTTPKeepAlive { + config.DisableHTTPKeepAlive = DefaultConfig.DisableHTTPKeepAlive } return config, err diff --git a/config/config_test.go b/config/config_test.go index ae0fe6ef..ee3a5795 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -100,7 +100,7 @@ func TestLoadConfig(t *testing.T) { t.Error("should be false (default value should be used)") } - if config.DisableHttpKeepAlive != false { + if config.DisableHTTPKeepAlive != false { t.Error("should be false (default value should be used)") } } diff --git a/mackerel/api.go b/mackerel/api.go index bb661c3a..c6a4e812 100644 --- a/mackerel/api.go +++ b/mackerel/api.go @@ -57,14 +57,14 @@ func infoError(msg string) *InfoError { } // NewAPI creates a new instance of API. -func NewAPI(rawurl string, apiKey string, verbose bool, disableHttpKeepAlive bool) (*API, error) { +func NewAPI(rawurl string, apiKey string, verbose bool, disableHTTPKeepAlive bool) (*API, error) { c, err := mkr.NewClientWithOptions(apiKey, rawurl, verbose) if err != nil { return nil, err } c.PrioritizedLogger = logger t := http.DefaultTransport.(*http.Transport).Clone() - t.DisableKeepAlives = disableHttpKeepAlive + t.DisableKeepAlives = disableHTTPKeepAlive c.HTTPClient.Transport = t return &API{Client: c}, nil