From 60c9bf49c2be13fc9052a097ee53481b20cd3a0e Mon Sep 17 00:00:00 2001 From: xuyasong <1154564309@qq.com> Date: Fri, 15 Mar 2019 17:48:36 +0800 Subject: [PATCH] fix golint error Signed-off-by: xuyasong <1154564309@qq.com> --- cli/alert_add.go | 6 +++--- cluster/cluster.go | 4 ++-- notify/impl.go | 36 ++++++++++++++++++------------------ 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cli/alert_add.go b/cli/alert_add.go index 123eba51..52ac4b6d 100644 --- a/cli/alert_add.go +++ b/cli/alert_add.go @@ -26,7 +26,7 @@ import ( type alertAddCmd struct { annotations []string - generatorUrl string + generatorURL string labels []string start string end string @@ -61,7 +61,7 @@ func configureAddAlertCmd(cc *kingpin.CmdClause) { addCmd = cc.Command("add", alertAddHelp) ) addCmd.Arg("labels", "List of labels to be included with the alert").StringsVar(&a.labels) - addCmd.Flag("generator-url", "Set the URL of the source that generated the alert").StringVar(&a.generatorUrl) + addCmd.Flag("generator-url", "Set the URL of the source that generated the alert").StringVar(&a.generatorURL) addCmd.Flag("start", "Set when the alert should start. RFC3339 format 2006-01-02T15:04:05-07:00").StringVar(&a.start) addCmd.Flag("end", "Set when the alert should should end. RFC3339 format 2006-01-02T15:04:05-07:00").StringVar(&a.end) addCmd.Flag("annotation", "Set an annotation to be included with the alert").StringsVar(&a.annotations) @@ -112,6 +112,6 @@ func (a *alertAddCmd) addAlert(ctx context.Context, _ *kingpin.ParseContext) err Annotations: annotations, StartsAt: startsAt, EndsAt: endsAt, - GeneratorURL: a.generatorUrl, + GeneratorURL: a.generatorURL, }) } diff --git a/cluster/cluster.go b/cluster/cluster.go index 676c3b3e..ec02cc7b 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -578,9 +578,9 @@ func (p *Peer) WaitReady() { func (p *Peer) Status() string { if p.Ready() { return "ready" - } else { - return "settling" } + + return "settling" } // Info returns a JSON-serializable dump of cluster state. diff --git a/notify/impl.go b/notify/impl.go index e3f9fcb8..9b0bb3cd 100644 --- a/notify/impl.go +++ b/notify/impl.go @@ -1113,25 +1113,25 @@ func (n *Wechat) Notify(ctx context.Context, as ...*types.Alert) (bool, error) { if resp.StatusCode != 200 { return true, fmt.Errorf("unexpected status code %v", resp.StatusCode) - } else { - var weResp weChatResponse - if err := json.Unmarshal(body, &weResp); err != nil { - return true, err - } - - // https://work.weixin.qq.com/api/doc#10649 - if weResp.Code == 0 { - return false, nil - } - - // AccessToken is expired - if weResp.Code == 42001 { - n.accessToken = "" - return true, errors.New(weResp.Error) - } - - return false, errors.New(weResp.Error) } + + var weResp weChatResponse + if err := json.Unmarshal(body, &weResp); err != nil { + return true, err + } + + // https://work.weixin.qq.com/api/doc#10649 + if weResp.Code == 0 { + return false, nil + } + + // AccessToken is expired + if weResp.Code == 42001 { + n.accessToken = "" + return true, errors.New(weResp.Error) + } + + return false, errors.New(weResp.Error) } // OpsGenie implements a Notifier for OpsGenie notifications.