Fix go vet warnings

This commit is contained in:
Fabian Reinartz 2015-11-05 10:25:25 +01:00
parent 6f0d441e39
commit 5ce39632f8
5 changed files with 6 additions and 8 deletions

View File

@ -314,7 +314,7 @@ func (c *NotificationConfig) UnmarshalYAML(unmarshal func(interface{}) error) er
// Regexp encapsulates a regexp.Regexp and makes it YAML marshallable. // Regexp encapsulates a regexp.Regexp and makes it YAML marshallable.
type Regexp struct { type Regexp struct {
regexp.Regexp *regexp.Regexp
} }
// UnmarshalYAML implements the yaml.Unmarshaler interface. // UnmarshalYAML implements the yaml.Unmarshaler interface.
@ -327,7 +327,7 @@ func (re *Regexp) UnmarshalYAML(unmarshal func(interface{}) error) error {
if err != nil { if err != nil {
return err return err
} }
re.Regexp = *regex re.Regexp = regex
return nil return nil
} }

View File

@ -90,7 +90,7 @@ func TestAggrGroup(t *testing.T) {
t.Errorf("wrong repeat interval: %q", ri) t.Errorf("wrong repeat interval: %q", ri)
} }
if sr, ok := notify.SendResolved(ctx); !ok || sr != opts.SendResolved { if sr, ok := notify.SendResolved(ctx); !ok || sr != opts.SendResolved {
t.Errorf("wrong send_resolved: %q", sr) t.Errorf("wrong send_resolved: %v", sr)
} }
last = current last = current

View File

@ -167,8 +167,6 @@ func (n *RetryNotifier) Notify(ctx context.Context, alerts ...*types.Alert) erro
return ctx.Err() return ctx.Err()
} }
} }
return nil
} }
type DedupingNotifier struct { type DedupingNotifier struct {

View File

@ -155,7 +155,7 @@ func TestDedupingNotifier(t *testing.T) {
// After a failing notify the notifies data must be unchanged. // After a failing notify the notifies data must be unchanged.
nsCur, err := notifies.Get("name", fps...) nsCur, err := notifies.Get("name", fps...)
if err != nil { if err != nil {
t.Fatalf("Error getting notifies", err) t.Fatalf("Error getting notifies: %s", err)
} }
if !reflect.DeepEqual(nsBefore, nsCur) { if !reflect.DeepEqual(nsBefore, nsCur) {
t.Fatalf("Notifies data has changed unexpectedly") t.Fatalf("Notifies data has changed unexpectedly")
@ -220,7 +220,7 @@ func TestDedupingNotifier(t *testing.T) {
} }
nsCur, err = notifies.Get("name", fps...) nsCur, err = notifies.Get("name", fps...)
if err != nil { if err != nil {
t.Fatalf("Error getting notifies", err) t.Fatalf("Error getting notifies: %s", err)
} }
// Hack correct timestamps back in if they are sane. // Hack correct timestamps back in if they are sane.

View File

@ -110,7 +110,7 @@ func (ms Matchers) Fingerprint() model.Fingerprint {
lset := make(model.LabelSet, 3*len(ms)) lset := make(model.LabelSet, 3*len(ms))
for _, m := range ms { for _, m := range ms {
lset[model.LabelName(fmt.Sprintf("%s-%s-%s", m.Name, m.Value, m.isRegex))] = "" lset[model.LabelName(fmt.Sprintf("%s-%s-%v", m.Name, m.Value, m.isRegex))] = ""
} }
return lset.Fingerprint() return lset.Fingerprint()