fix golint error
Signed-off-by: xuyasong <1154564309@qq.com>
This commit is contained in:
parent
8688c7b9ad
commit
60c9bf49c2
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue