Skip to content

Commit

Permalink
Cleanup and fix golangci-lint config (#2488)
Browse files Browse the repository at this point in the history
* Cleanup and fix golangci-lint config

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Fixed goimport

Signed-off-by: Marco Pracucci <marco@pracucci.com>
  • Loading branch information
pracucci committed Apr 20, 2020
1 parent b94b3b1 commit c52331d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
11 changes: 11 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ output:
linters:
enable:
- goimports
- golint
- gofmt
- misspell

linters-settings:
errcheck:
Expand All @@ -12,3 +15,11 @@ linters-settings:
exclude: ./.errcheck-exclude
goimports:
local-prefixes: "github.com/cortexproject/cortex"

run:
timeout: 5m

# List of build tags, all linters use it.
build-tags:
- netgo
- requires_docker
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ protos: $(PROTO_GOS)

lint:
misspell -error docs
golangci-lint run --build-tags netgo,require_docker --timeout=5m --enable golint --enable misspell --enable gofmt

# Configured via .golangci.yml.
golangci-lint run

# Ensure no blacklisted package is imported.
faillint -paths "github.com/bmizerany/assert=github.com/stretchr/testify/assert" ./pkg/... ./cmd/... ./tools/... ./integration/...
Expand Down
2 changes: 1 addition & 1 deletion integration/api_ruler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestRulerAPI(t *testing.T) {
Name: "test_encoded_+\"+group_name?",
Interval: 100,
Rules: []rulefmt.Rule{
rulefmt.Rule{
{
Record: "test_rule",
Expr: "up",
},
Expand Down
16 changes: 8 additions & 8 deletions integration/asserts.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ const (
var (
// Service-specific metrics prefixes which shouldn't be used by any other service.
serviceMetricsPrefixes = map[ServiceType][]string{
Distributor: []string{},
Ingester: []string{"!cortex_ingester_client", "cortex_ingester"}, // The metrics prefix cortex_ingester_client may be used by other components so we ignore it.
Querier: []string{},
QueryFrontend: []string{"cortex_frontend", "cortex_query_frontend"},
TableManager: []string{},
AlertManager: []string{"cortex_alertmanager"},
Ruler: []string{},
StoreGateway: []string{"!cortex_storegateway_client", "cortex_storegateway"}, // The metrics prefix cortex_storegateway_client may be used by other components so we ignore it.
Distributor: {},
Ingester: {"!cortex_ingester_client", "cortex_ingester"}, // The metrics prefix cortex_ingester_client may be used by other components so we ignore it.
Querier: {},
QueryFrontend: {"cortex_frontend", "cortex_query_frontend"},
TableManager: {},
AlertManager: {"cortex_alertmanager"},
Ruler: {},
StoreGateway: {"!cortex_storegateway_client", "cortex_storegateway"}, // The metrics prefix cortex_storegateway_client may be used by other components so we ignore it.
}

// Blacklisted metrics prefixes across any Cortex service.
Expand Down
3 changes: 2 additions & 1 deletion integration/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/cortexproject/cortex/integration/e2e"
e2edb "github.com/cortexproject/cortex/integration/e2e/db"
"github.com/cortexproject/cortex/pkg/ring/kv"
"github.com/cortexproject/cortex/pkg/ring/kv/consul"
"github.com/cortexproject/cortex/pkg/ring/kv/etcd"
"github.com/stretchr/testify/require"
)

func TestKV_List_Delete(t *testing.T) {
Expand Down

0 comments on commit c52331d

Please sign in to comment.