Skip to content

goimports -local github.com/cortexproject/cortex -w pkg/ cmd/ tools/ #2106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
output:
format: line-number

linters:
enable:
- goimports

linters-settings:
errcheck:
# path to a file containing a list of functions to exclude from checking
# see https://github.com/kisielk/errcheck#excluding-functions for details
exclude: ./.errcheck-exclude
goimports:
local-prefixes: "github.com/cortexproject/cortex"
3 changes: 2 additions & 1 deletion pkg/chunk/aws/aws_autoscaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (
"github.com/go-kit/kit/log/level"
"github.com/prometheus/client_golang/prometheus"

"github.com/weaveworks/common/instrument"

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/util"
"github.com/weaveworks/common/instrument"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions pkg/chunk/aws/dynamodb_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ import (
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface"
"github.com/prometheus/client_golang/prometheus"

awscommon "github.com/weaveworks/common/aws"
"github.com/weaveworks/common/instrument"

"github.com/cortexproject/cortex/pkg/chunk"
chunk_util "github.com/cortexproject/cortex/pkg/chunk/util"
"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/cortexproject/cortex/pkg/util/spanlogger"
awscommon "github.com/weaveworks/common/aws"
"github.com/weaveworks/common/instrument"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/aws/dynamodb_table_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import (
"github.com/pkg/errors"
"golang.org/x/time/rate"

"github.com/weaveworks/common/instrument"

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/util"
"github.com/weaveworks/common/instrument"
)

// Pluggable auto-scaler implementation
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/aws/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import (
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3iface"
"github.com/cortexproject/cortex/pkg/util"
"github.com/go-kit/kit/log/level"

"github.com/cortexproject/cortex/pkg/util"
)

const arnPrefix = "arn:"
Expand Down
5 changes: 3 additions & 2 deletions pkg/chunk/aws/s3_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ import (
"github.com/aws/aws-sdk-go/service/s3/s3iface"
"github.com/prometheus/client_golang/prometheus"

awscommon "github.com/weaveworks/common/aws"
"github.com/weaveworks/common/instrument"

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/chunk/util"
"github.com/cortexproject/cortex/pkg/util/flagext"
awscommon "github.com/weaveworks/common/aws"
"github.com/weaveworks/common/instrument"
)

var (
Expand Down
7 changes: 4 additions & 3 deletions pkg/chunk/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import (
"testing"
"time"

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/chunk/cache"
prom_chunk "github.com/cortexproject/cortex/pkg/chunk/encoding"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/pkg/labels"
"github.com/stretchr/testify/require"

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/chunk/cache"
prom_chunk "github.com/cortexproject/cortex/pkg/chunk/encoding"
)

const userID = "1"
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/cache/memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import (
"time"

"github.com/bradfitz/gomemcache/memcache"
"github.com/cortexproject/cortex/pkg/util"
"github.com/go-kit/kit/log/level"
opentracing "github.com/opentracing/opentracing-go"
otlog "github.com/opentracing/opentracing-go/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
instr "github.com/weaveworks/common/instrument"

"github.com/cortexproject/cortex/pkg/util"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/cache/memcached_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
"time"

"github.com/bradfitz/gomemcache/memcache"
"github.com/cortexproject/cortex/pkg/util"
"github.com/go-kit/kit/log/level"

"github.com/cortexproject/cortex/pkg/util"
)

// MemcachedClient interface exists for mocking memcacheClient.
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/cache/memcached_client_selector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"testing"

"github.com/bradfitz/gomemcache/memcache"
"github.com/cortexproject/cortex/pkg/chunk/cache"
"github.com/facette/natsort"
"github.com/stretchr/testify/require"

"github.com/cortexproject/cortex/pkg/chunk/cache"
)

func TestNatSort(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/cache/memcached_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"testing"

"github.com/bradfitz/gomemcache/memcache"
"github.com/cortexproject/cortex/pkg/chunk/cache"
"github.com/stretchr/testify/require"

"github.com/cortexproject/cortex/pkg/chunk/cache"
)

func TestMemcached(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/cache/redis_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"flag"
"time"

"github.com/cortexproject/cortex/pkg/util"
"github.com/go-kit/kit/log/level"
"github.com/gomodule/redigo/redis"

"github.com/cortexproject/cortex/pkg/util"
)

// RedisCache type caches chunks in redis
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/cache/redis_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"testing"
"time"

"github.com/cortexproject/cortex/pkg/chunk/cache"
"github.com/gomodule/redigo/redis"
"github.com/rafaeljusto/redigomock"
"github.com/stretchr/testify/require"

"github.com/cortexproject/cortex/pkg/chunk/cache"
)

func TestRedisCache(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/cache/snappy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package cache
import (
"context"

"github.com/cortexproject/cortex/pkg/util"
"github.com/go-kit/kit/log/level"
"github.com/golang/snappy"

"github.com/cortexproject/cortex/pkg/util"
)

type snappyCache struct {
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/cache/tiered_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"testing"

"github.com/cortexproject/cortex/pkg/chunk/cache"
"github.com/stretchr/testify/require"

"github.com/cortexproject/cortex/pkg/chunk/cache"
)

func TestTieredSimple(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions pkg/chunk/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import (
"strings"
"sync"

prom_chunk "github.com/cortexproject/cortex/pkg/chunk/encoding"
"github.com/cortexproject/cortex/pkg/prom1/storage/metric"
"github.com/golang/snappy"
jsoniter "github.com/json-iterator/go"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/pkg/labels"

prom_chunk "github.com/cortexproject/cortex/pkg/chunk/encoding"
"github.com/cortexproject/cortex/pkg/prom1/storage/metric"

errs "github.com/weaveworks/common/errors"
)

Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/chunk_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ import (
"github.com/prometheus/prometheus/pkg/labels"
"github.com/prometheus/prometheus/promql"

"github.com/weaveworks/common/httpgrpc"

"github.com/cortexproject/cortex/pkg/chunk/cache"
"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/extract"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/cortexproject/cortex/pkg/util/spanlogger"
"github.com/cortexproject/cortex/pkg/util/validation"
"github.com/weaveworks/common/httpgrpc"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions pkg/chunk/chunk_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/weaveworks/common/test"
"github.com/weaveworks/common/user"

"github.com/cortexproject/cortex/pkg/chunk/cache"
"github.com/cortexproject/cortex/pkg/chunk/encoding"
"github.com/cortexproject/cortex/pkg/util/extract"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/cortexproject/cortex/pkg/util/validation"
"github.com/weaveworks/common/test"
"github.com/weaveworks/common/user"
)

type configFactory func() StoreConfig
Expand Down
7 changes: 4 additions & 3 deletions pkg/chunk/chunk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import (
"testing"
"time"

"github.com/cortexproject/cortex/pkg/chunk/encoding"
"github.com/cortexproject/cortex/pkg/ingester/client"
"github.com/cortexproject/cortex/pkg/util"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/pkg/labels"
"github.com/stretchr/testify/require"

"github.com/cortexproject/cortex/pkg/chunk/encoding"
"github.com/cortexproject/cortex/pkg/ingester/client"
"github.com/cortexproject/cortex/pkg/util"
)

const userID = "userID"
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"context"
"time"

"github.com/cortexproject/cortex/pkg/util"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/pkg/labels"

"github.com/cortexproject/cortex/pkg/util"
)

// BenchmarkLabels is a real example from Kubernetes' embedded cAdvisor metrics, lightly obfuscated
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/gcp/bigtable_index_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import (
ot "github.com/opentracing/opentracing-go"
otlog "github.com/opentracing/opentracing-go/log"

"github.com/pkg/errors"

"github.com/cortexproject/cortex/pkg/chunk"
chunk_util "github.com/cortexproject/cortex/pkg/chunk/util"
"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/grpcclient"
"github.com/pkg/errors"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/gcp/table_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
"cloud.google.com/go/bigtable"
"google.golang.org/grpc/status"

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/pkg/errors"

"github.com/cortexproject/cortex/pkg/chunk"
)

type tableClient struct {
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/inmemory_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"sort"
"sync"

"github.com/cortexproject/cortex/pkg/util"
"github.com/go-kit/kit/log/level"

"github.com/cortexproject/cortex/pkg/util"
)

// MockStorage is a fake in-memory StorageClient.
Expand Down
5 changes: 3 additions & 2 deletions pkg/chunk/storage/caching_index_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
"testing"
"time"

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/chunk/cache"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/weaveworks/common/user"

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/chunk/cache"
)

var ctx = user.InjectOrgID(context.Background(), "1")
Expand Down
5 changes: 3 additions & 2 deletions pkg/chunk/storage/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (
"strings"
"time"

"github.com/go-kit/kit/log/level"
"github.com/pkg/errors"

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/chunk/aws"
"github.com/cortexproject/cortex/pkg/chunk/azure"
Expand All @@ -15,8 +18,6 @@ import (
"github.com/cortexproject/cortex/pkg/chunk/gcp"
"github.com/cortexproject/cortex/pkg/chunk/local"
"github.com/cortexproject/cortex/pkg/util"
"github.com/go-kit/kit/log/level"
"github.com/pkg/errors"
)

// Supported storage engines
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/storage/object_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (

"github.com/stretchr/testify/require"

"github.com/prometheus/common/model"

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/chunk/testutils"
"github.com/prometheus/common/model"
)

func TestChunksBasic(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/storage/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package storage
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/chunk/aws"
"github.com/cortexproject/cortex/pkg/chunk/cassandra"
"github.com/cortexproject/cortex/pkg/chunk/gcp"
"github.com/cortexproject/cortex/pkg/chunk/local"
"github.com/cortexproject/cortex/pkg/chunk/testutils"
"github.com/stretchr/testify/require"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/table_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"

"github.com/cortexproject/cortex/pkg/util"
"github.com/weaveworks/common/instrument"
"github.com/weaveworks/common/mtime"

"github.com/cortexproject/cortex/pkg/util"
)

const (
Expand Down
Loading