diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index 8f7b65bdc9..db093dd324 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -241,7 +241,7 @@ func reloadConfig(filename string, rls ...Reloadable) (err error) { } } if failed { - return fmt.Errorf("one or more errors occured while applying the new configuration (-config.file=%s)", filename) + return fmt.Errorf("one or more errors occurred while applying the new configuration (-config.file=%s)", filename) } return nil } diff --git a/notifier/notifier_test.go b/notifier/notifier_test.go index af87c4085a..1d876e50a8 100644 --- a/notifier/notifier_test.go +++ b/notifier/notifier_test.go @@ -191,12 +191,12 @@ func TestHandlerRelabel(t *testing.T) { h := New(&Options{ QueueCapacity: 3 * maxBatchSize, RelabelConfigs: []*config.RelabelConfig{ - &config.RelabelConfig{ + { SourceLabels: model.LabelNames{"alertname"}, Action: "drop", Regex: config.MustNewRegexp("drop"), }, - &config.RelabelConfig{ + { SourceLabels: model.LabelNames{"alertname"}, TargetLabel: "alertname", Action: "replace", @@ -221,7 +221,7 @@ func TestHandlerRelabel(t *testing.T) { }) expected := []*model.Alert{ - &model.Alert{ + { Labels: model.LabelSet{ "alertname": "renamed", }, diff --git a/promql/parse.go b/promql/parse.go index 6acaa11de3..71ad87de02 100644 --- a/promql/parse.go +++ b/promql/parse.go @@ -48,7 +48,7 @@ func (e *ParseErr) Error() string { return fmt.Sprintf("parse error at line %d, char %d: %s", e.Line, e.Pos, e.Err) } -// ParseStmts parses the input and returns the resulting statements or any occuring error. +// ParseStmts parses the input and returns the resulting statements or any occurring error. func ParseStmts(input string) (Statements, error) { p := newParser(input) diff --git a/promql/parse_test.go b/promql/parse_test.go index 191cd39e17..5dd97fc238 100644 --- a/promql/parse_test.go +++ b/promql/parse_test.go @@ -1366,9 +1366,9 @@ var testExpr = []struct { fail: true, errMsg: "expected type vector in call to function \"floor\", got scalar", }, { - input: "non_existant_function_far_bar()", + input: "non_existent_function_far_bar()", fail: true, - errMsg: "unknown function with name \"non_existant_function_far_bar\"", + errMsg: "unknown function with name \"non_existent_function_far_bar\"", }, { input: "rate(some_metric)", fail: true, diff --git a/retrieval/discovery/kubernetes/discovery_test.go b/retrieval/discovery/kubernetes/discovery_test.go index fc26b02b42..89ea76d69c 100644 --- a/retrieval/discovery/kubernetes/discovery_test.go +++ b/retrieval/discovery/kubernetes/discovery_test.go @@ -29,7 +29,7 @@ func TestMain(m *testing.M) { } var portsA = []ContainerPort{ - ContainerPort{ + { Name: "http", ContainerPort: 80, Protocol: "TCP", @@ -37,7 +37,7 @@ var portsA = []ContainerPort{ } var portsB = []ContainerPort{ - ContainerPort{ + { Name: "https", ContainerPort: 443, Protocol: "TCP", @@ -45,7 +45,7 @@ var portsB = []ContainerPort{ } var portsNoTcp = []ContainerPort{ - ContainerPort{ + { Name: "dns", ContainerPort: 53, Protocol: "UDP", @@ -53,12 +53,12 @@ var portsNoTcp = []ContainerPort{ } var portsMultiA = []ContainerPort{ - ContainerPort{ + { Name: "http", ContainerPort: 80, Protocol: "TCP", }, - ContainerPort{ + { Name: "ssh", ContainerPort: 22, Protocol: "TCP", @@ -66,12 +66,12 @@ var portsMultiA = []ContainerPort{ } var portsMultiB = []ContainerPort{ - ContainerPort{ + { Name: "http", ContainerPort: 80, Protocol: "TCP", }, - ContainerPort{ + { Name: "https", ContainerPort: 443, Protocol: "TCP", @@ -112,7 +112,7 @@ func pod(name string, containers []Container) *Pod { PodIP: "1.1.1.1", Phase: "Running", Conditions: []PodCondition{ - PodCondition{ + { Type: "Ready", Status: "True", }, diff --git a/retrieval/scrape_test.go b/retrieval/scrape_test.go index bb641d4cd3..e07cbdc85f 100644 --- a/retrieval/scrape_test.go +++ b/retrieval/scrape_test.go @@ -137,7 +137,7 @@ func TestScrapePoolReload(t *testing.T) { ScrapeInterval: model.Duration(3 * time.Second), ScrapeTimeout: model.Duration(2 * time.Second), } - // On starting to run, new loops created on reload check whether their preceeding + // On starting to run, new loops created on reload check whether their preceding // equivalents have been stopped. newLoop := func(ctx context.Context, s scraper, app, reportApp storage.SampleAppender) loop { l := &testLoop{} @@ -163,7 +163,7 @@ func TestScrapePoolReload(t *testing.T) { } // Reloading a scrape pool with a new scrape configuration must stop all scrape - // loops and start new ones. A new loop must not be started before the preceeding + // loops and start new ones. A new loop must not be started before the preceding // one terminated. for i := 0; i < numTargets; i++ { diff --git a/retrieval/target_test.go b/retrieval/target_test.go index d0d7018d62..6b8f55c4f1 100644 --- a/retrieval/target_test.go +++ b/retrieval/target_test.go @@ -122,7 +122,7 @@ func TestTargetURL(t *testing.T) { } if u := target.URL(); !reflect.DeepEqual(u.String(), expectedURL.String()) { - t.Fatalf("Expected URL %q but got %q", expectedURL, u) + t.Fatalf("Expected URL %q, but got %q", expectedURL.String(), u.String()) } } diff --git a/storage/local/persistence_test.go b/storage/local/persistence_test.go index a111c61091..d7141b059a 100644 --- a/storage/local/persistence_test.go +++ b/storage/local/persistence_test.go @@ -152,6 +152,9 @@ func testPersistLoadDropChunks(t *testing.T, encoding chunkEncoding) { } // Load chunk descs partially. actualChunkDescs, err = p.loadChunkDescs(fp, 5) + if err != nil { + t.Fatal(err) + } if len(actualChunkDescs) != 5 { t.Errorf("Got %d chunkDescs, want %d.", len(actualChunkDescs), 5) } diff --git a/storage/local/storage_test.go b/storage/local/storage_test.go index b5025827f7..d04c5ac92e 100644 --- a/storage/local/storage_test.go +++ b/storage/local/storage_test.go @@ -145,7 +145,7 @@ func TestMatches(t *testing.T) { matchers: metric.LabelMatchers{ newMatcher(metric.Equal, "all", "const"), newMatcher(metric.NotEqual, "label1", "test_0"), - newMatcher(metric.Equal, "not_existant", ""), + newMatcher(metric.Equal, "not_existent", ""), }, expected: fingerprints[10:], }, diff --git a/storage/remote/client.go b/storage/remote/client.go index de7a3100f1..563f47c003 100644 --- a/storage/remote/client.go +++ b/storage/remote/client.go @@ -40,7 +40,7 @@ func NewClient(address string, timeout time.Duration) (*Client, error) { // grpc.Dial() returns immediately and doesn't error when the server is // unreachable when not passing in the WithBlock() option. The client then // will continuously try to (re)establish the connection in the background. - // So this will only return here if some other uncommon error occured. + // So this will only return here if some other uncommon error occurred. return nil, err } return &Client{ @@ -66,7 +66,7 @@ func (c *Client) Store(samples model.Samples) error { }) } ts.Samples = []*Sample{ - &Sample{ + { Value: float64(s.Value), TimestampMs: int64(s.Timestamp), },