This is an automated email from the ASF dual-hosted git repository. hanahmily pushed a commit to branch ci-format in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git
commit fe6cb0e9b645273a4fd142a2a32d70659009b06e Author: Gao Hongtao <[email protected]> AuthorDate: Fri Oct 7 05:49:14 2022 +0000 Make imports order determinitic Signed-off-by: Gao Hongtao <[email protected]> --- .golangci-format.yml | 9 ++++++++- .golangci.yml | 9 ++++++--- banyand/liaison/grpc/registry_test.go | 1 - banyand/stream/metadata.go | 1 - banyand/tsdb/block.go | 3 ++- banyand/tsdb/retention.go | 3 ++- banyand/tsdb/segment.go | 3 ++- bydbctl/internal/cmd/group.go | 2 +- bydbctl/internal/cmd/root.go | 3 ++- bydbctl/internal/cmd/stream.go | 2 +- bydbctl/internal/cmd/stream_test.go | 14 +++++++------- bydbctl/internal/cmd/use.go | 3 ++- deprecated-golangci.yml | 7 ++++++- pkg/index/lsm/lsm.go | 3 ++- pkg/query/logical/index_filter.go | 3 ++- pkg/query/logical/measure/schema.go | 6 +++--- pkg/query/logical/tag_filter.go | 3 ++- pkg/signal/handler.go | 6 ++++-- pkg/test/setup/setup.go | 4 ++-- pkg/test/stream/traffic/traffic.go | 1 - pkg/timestamp/nano.go | 1 - scripts/build/lint-bin.mk | 2 +- test/cases/stream/stream.go | 9 ++++----- test/integration/cold_query/query_suite_test.go | 9 +++++---- test/integration/other/measure_test.go | 6 +++--- test/integration/other/other_suite_test.go | 3 ++- test/integration/other/property_test.go | 2 +- test/integration/other/tls_test.go | 6 +++--- test/integration/query/query_suite_test.go | 9 +++++---- 29 files changed, 78 insertions(+), 55 deletions(-) diff --git a/.golangci-format.yml b/.golangci-format.yml index 50c5c15..ed57d0a 100644 --- a/.golangci-format.yml +++ b/.golangci-format.yml @@ -27,10 +27,17 @@ run: linters: disable-all: true enable: - - goimports + - gci - gofumpt fast: false +linters-settings: + gci: + sections: + - standard + - default + - prefix(github.com/apache/skywalking-banyandb/) + issues: max-per-linter: 0 max-same-issues: 0 diff --git a/.golangci.yml b/.golangci.yml index 1bc0bed..b6c7871 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,12 +16,11 @@ linters: disable-all: true enable: - - deadcode - errcheck - gocritic - goconst - gofumpt - - goimports + - gci - gosimple - govet - ineffassign @@ -31,7 +30,6 @@ linters: - stylecheck - typecheck - unconvert - - varcheck - prealloc - unused linters-settings: @@ -49,6 +47,11 @@ linters-settings: check-exported: false unparam: check-exported: false + gci: + sections: + - standard + - default + - prefix(github.com/apache/skywalking-banyandb/) gocritic: enabled-checks: - appendCombine diff --git a/banyand/liaison/grpc/registry_test.go b/banyand/liaison/grpc/registry_test.go index f22cd0a..03c6d84 100644 --- a/banyand/liaison/grpc/registry_test.go +++ b/banyand/liaison/grpc/registry_test.go @@ -34,7 +34,6 @@ import ( "github.com/apache/skywalking-banyandb/banyand/metadata" "github.com/apache/skywalking-banyandb/banyand/queue" "github.com/apache/skywalking-banyandb/pkg/test" - teststream "github.com/apache/skywalking-banyandb/pkg/test/stream" ) diff --git a/banyand/stream/metadata.go b/banyand/stream/metadata.go index 870a887..980c347 100644 --- a/banyand/stream/metadata.go +++ b/banyand/stream/metadata.go @@ -32,7 +32,6 @@ import ( "github.com/apache/skywalking-banyandb/banyand/tsdb" "github.com/apache/skywalking-banyandb/pkg/encoding" "github.com/apache/skywalking-banyandb/pkg/logger" - pb_v1 "github.com/apache/skywalking-banyandb/pkg/pb/v1" resourceSchema "github.com/apache/skywalking-banyandb/pkg/schema" ) diff --git a/banyand/tsdb/block.go b/banyand/tsdb/block.go index 5e8c699..2d930de 100644 --- a/banyand/tsdb/block.go +++ b/banyand/tsdb/block.go @@ -29,6 +29,8 @@ import ( "sync/atomic" "time" + "github.com/pkg/errors" + "github.com/apache/skywalking-banyandb/api/common" "github.com/apache/skywalking-banyandb/banyand/kv" "github.com/apache/skywalking-banyandb/banyand/observability" @@ -39,7 +41,6 @@ import ( "github.com/apache/skywalking-banyandb/pkg/index/lsm" "github.com/apache/skywalking-banyandb/pkg/logger" "github.com/apache/skywalking-banyandb/pkg/timestamp" - "github.com/pkg/errors" ) const ( diff --git a/banyand/tsdb/retention.go b/banyand/tsdb/retention.go index 957c268..ab61a8d 100644 --- a/banyand/tsdb/retention.go +++ b/banyand/tsdb/retention.go @@ -21,8 +21,9 @@ import ( "sync" "time" - "github.com/apache/skywalking-banyandb/pkg/logger" "github.com/robfig/cron/v3" + + "github.com/apache/skywalking-banyandb/pkg/logger" ) type retentionController struct { diff --git a/banyand/tsdb/segment.go b/banyand/tsdb/segment.go index bbdad22..ed1bd3c 100644 --- a/banyand/tsdb/segment.go +++ b/banyand/tsdb/segment.go @@ -27,13 +27,14 @@ import ( "sync" "time" + "go.uber.org/multierr" + "github.com/apache/skywalking-banyandb/api/common" "github.com/apache/skywalking-banyandb/banyand/kv" "github.com/apache/skywalking-banyandb/banyand/observability" "github.com/apache/skywalking-banyandb/banyand/tsdb/bucket" "github.com/apache/skywalking-banyandb/pkg/logger" "github.com/apache/skywalking-banyandb/pkg/timestamp" - "go.uber.org/multierr" ) var ErrEndOfSegment = errors.New("reached the end of the segment") diff --git a/bydbctl/internal/cmd/group.go b/bydbctl/internal/cmd/group.go index 7938a38..cf5e5d0 100644 --- a/bydbctl/internal/cmd/group.go +++ b/bydbctl/internal/cmd/group.go @@ -21,13 +21,13 @@ import ( "encoding/json" "fmt" - "github.com/apache/skywalking-banyandb/pkg/version" "github.com/go-resty/resty/v2" "github.com/spf13/cobra" "google.golang.org/protobuf/encoding/protojson" common_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/common/v1" database_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1" + "github.com/apache/skywalking-banyandb/pkg/version" ) func newGroupCmd() *cobra.Command { diff --git a/bydbctl/internal/cmd/root.go b/bydbctl/internal/cmd/root.go index c7fd7e3..d6669a1 100644 --- a/bydbctl/internal/cmd/root.go +++ b/bydbctl/internal/cmd/root.go @@ -22,9 +22,10 @@ import ( "fmt" "os" - "github.com/apache/skywalking-banyandb/pkg/version" "github.com/spf13/cobra" "github.com/spf13/viper" + + "github.com/apache/skywalking-banyandb/pkg/version" ) var ( diff --git a/bydbctl/internal/cmd/stream.go b/bydbctl/internal/cmd/stream.go index 00316ad..719ec32 100644 --- a/bydbctl/internal/cmd/stream.go +++ b/bydbctl/internal/cmd/stream.go @@ -21,13 +21,13 @@ import ( "encoding/json" "fmt" - "github.com/apache/skywalking-banyandb/pkg/version" "github.com/go-resty/resty/v2" "github.com/spf13/cobra" "github.com/spf13/viper" "google.golang.org/protobuf/encoding/protojson" database_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1" + "github.com/apache/skywalking-banyandb/pkg/version" ) const streamSchemaPath = "/api/v1/stream/schema" diff --git a/bydbctl/internal/cmd/stream_test.go b/bydbctl/internal/cmd/stream_test.go index 479c136..966d99f 100644 --- a/bydbctl/internal/cmd/stream_test.go +++ b/bydbctl/internal/cmd/stream_test.go @@ -22,6 +22,13 @@ import ( "strings" "time" + "github.com/ghodss/yaml" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "github.com/spf13/cobra" + "github.com/zenizh/go-capturer" + + database_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1" "github.com/apache/skywalking-banyandb/banyand/discovery" "github.com/apache/skywalking-banyandb/banyand/liaison/grpc" "github.com/apache/skywalking-banyandb/banyand/liaison/http" @@ -33,13 +40,6 @@ import ( "github.com/apache/skywalking-banyandb/bydbctl/internal/cmd" "github.com/apache/skywalking-banyandb/pkg/test" "github.com/apache/skywalking-banyandb/pkg/test/helpers" - "github.com/ghodss/yaml" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - "github.com/zenizh/go-capturer" - - database_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1" ) var _ = Describe("Stream", func() { diff --git a/bydbctl/internal/cmd/use.go b/bydbctl/internal/cmd/use.go index a4429bf..33cc9af 100644 --- a/bydbctl/internal/cmd/use.go +++ b/bydbctl/internal/cmd/use.go @@ -20,9 +20,10 @@ package cmd import ( "fmt" - "github.com/apache/skywalking-banyandb/pkg/version" "github.com/spf13/cobra" "github.com/spf13/viper" + + "github.com/apache/skywalking-banyandb/pkg/version" ) func newUserCmd() *cobra.Command { diff --git a/deprecated-golangci.yml b/deprecated-golangci.yml index f79312b..c42eca4 100644 --- a/deprecated-golangci.yml +++ b/deprecated-golangci.yml @@ -26,7 +26,7 @@ linters: - unconvert - varcheck - govet - - goimports + - gci - prealloc - unused - staticcheck @@ -41,6 +41,11 @@ linters-settings: min-occurrences: 4 govet: check-shadowing: true + gci: + sections: + - standard + - default + - prefix(github.com/apache/skywalking-banyandb/) run: deadline: 10m skip-files: diff --git a/pkg/index/lsm/lsm.go b/pkg/index/lsm/lsm.go index 7af6cd2..8c366ad 100644 --- a/pkg/index/lsm/lsm.go +++ b/pkg/index/lsm/lsm.go @@ -18,13 +18,14 @@ package lsm import ( + "go.uber.org/multierr" + "github.com/apache/skywalking-banyandb/api/common" "github.com/apache/skywalking-banyandb/banyand/kv" "github.com/apache/skywalking-banyandb/banyand/observability" "github.com/apache/skywalking-banyandb/pkg/convert" "github.com/apache/skywalking-banyandb/pkg/index" "github.com/apache/skywalking-banyandb/pkg/logger" - "go.uber.org/multierr" ) var _ index.Store = (*store)(nil) diff --git a/pkg/query/logical/index_filter.go b/pkg/query/logical/index_filter.go index ef49386..847dbd3 100644 --- a/pkg/query/logical/index_filter.go +++ b/pkg/query/logical/index_filter.go @@ -23,6 +23,8 @@ import ( "encoding/json" "strings" + "github.com/pkg/errors" + "github.com/apache/skywalking-banyandb/api/common" database_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1" model_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1" @@ -30,7 +32,6 @@ import ( "github.com/apache/skywalking-banyandb/pkg/convert" "github.com/apache/skywalking-banyandb/pkg/index" "github.com/apache/skywalking-banyandb/pkg/index/posting" - "github.com/pkg/errors" ) var ( diff --git a/pkg/query/logical/measure/schema.go b/pkg/query/logical/measure/schema.go index a7a2ed5..7dcf54d 100644 --- a/pkg/query/logical/measure/schema.go +++ b/pkg/query/logical/measure/schema.go @@ -18,12 +18,12 @@ package measure import ( - databasev1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1" + "github.com/google/go-cmp/cmp" + "github.com/pkg/errors" + databasev1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1" "github.com/apache/skywalking-banyandb/banyand/tsdb" "github.com/apache/skywalking-banyandb/pkg/query/logical" - "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" ) type schema struct { diff --git a/pkg/query/logical/tag_filter.go b/pkg/query/logical/tag_filter.go index 6402972..08718b4 100644 --- a/pkg/query/logical/tag_filter.go +++ b/pkg/query/logical/tag_filter.go @@ -22,8 +22,9 @@ import ( "fmt" "strings" - model_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1" "github.com/pkg/errors" + + model_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1" ) var ErrUnsupportedLogicalOperation = errors.New("unsupported logical operation") diff --git a/pkg/signal/handler.go b/pkg/signal/handler.go index 79cab77..0ff833f 100644 --- a/pkg/signal/handler.go +++ b/pkg/signal/handler.go @@ -28,8 +28,10 @@ import ( ) // ErrSignal is returned when a termination signal is received. -var ErrSignal = errors.New("signal received") -var _ run.Service = (*Handler)(nil) +var ( + ErrSignal = errors.New("signal received") + _ run.Service = (*Handler)(nil) +) // Handler implements a unix signal handler as run.GroupService. type Handler struct { diff --git a/pkg/test/setup/setup.go b/pkg/test/setup/setup.go index b96092c..50997c3 100644 --- a/pkg/test/setup/setup.go +++ b/pkg/test/setup/setup.go @@ -21,6 +21,8 @@ import ( "context" "fmt" + "github.com/onsi/gomega" + "github.com/apache/skywalking-banyandb/banyand/discovery" "github.com/apache/skywalking-banyandb/banyand/liaison/grpc" "github.com/apache/skywalking-banyandb/banyand/measure" @@ -31,8 +33,6 @@ import ( "github.com/apache/skywalking-banyandb/pkg/test" test_measure "github.com/apache/skywalking-banyandb/pkg/test/measure" test_stream "github.com/apache/skywalking-banyandb/pkg/test/stream" - - "github.com/onsi/gomega" ) const host = "127.0.0.1" diff --git a/pkg/test/stream/traffic/traffic.go b/pkg/test/stream/traffic/traffic.go index 93ac164..09bed21 100644 --- a/pkg/test/stream/traffic/traffic.go +++ b/pkg/test/stream/traffic/traffic.go @@ -20,7 +20,6 @@ package traffic import ( "context" "crypto/rand" - // Load some tag templates _ "embed" "encoding/base64" diff --git a/pkg/timestamp/nano.go b/pkg/timestamp/nano.go index c83decb..259629a 100644 --- a/pkg/timestamp/nano.go +++ b/pkg/timestamp/nano.go @@ -19,7 +19,6 @@ package timestamp import ( "math" "time" - // link runtime pkg fastrand _ "unsafe" diff --git a/scripts/build/lint-bin.mk b/scripts/build/lint-bin.mk index b33b5a5..0668b74 100644 --- a/scripts/build/lint-bin.mk +++ b/scripts/build/lint-bin.mk @@ -1,4 +1,4 @@ LINTER := $(tool_bin)/golangci-lint $(LINTER): - @GOBIN=$(tool_bin) go install github.com/golangci/golangci-lint/cmd/[email protected] + @GOBIN=$(tool_bin) go install github.com/golangci/golangci-lint/cmd/[email protected] diff --git a/test/cases/stream/stream.go b/test/cases/stream/stream.go index 46d6817..d48838d 100644 --- a/test/cases/stream/stream.go +++ b/test/cases/stream/stream.go @@ -31,17 +31,16 @@ import ( "github.com/google/go-cmp/cmp" g "github.com/onsi/ginkgo/v2" gm "github.com/onsi/gomega" + grpclib "google.golang.org/grpc" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/known/timestamppb" "sigs.k8s.io/yaml" common_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/common/v1" model_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1" stream_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/stream/v1" "github.com/apache/skywalking-banyandb/pkg/test/helpers" - - grpclib "google.golang.org/grpc" - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/testing/protocmp" - "google.golang.org/protobuf/types/known/timestamppb" ) // SharedContext is the parallel execution context diff --git a/test/integration/cold_query/query_suite_test.go b/test/integration/cold_query/query_suite_test.go index 6f9ed17..d233b04 100644 --- a/test/integration/cold_query/query_suite_test.go +++ b/test/integration/cold_query/query_suite_test.go @@ -21,6 +21,11 @@ import ( "testing" "time" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + grpclib "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "github.com/apache/skywalking-banyandb/pkg/logger" "github.com/apache/skywalking-banyandb/pkg/test/helpers" "github.com/apache/skywalking-banyandb/pkg/test/setup" @@ -28,10 +33,6 @@ import ( cases_measure "github.com/apache/skywalking-banyandb/test/cases/measure" cases_measure_data "github.com/apache/skywalking-banyandb/test/cases/measure/data" cases_stream "github.com/apache/skywalking-banyandb/test/cases/stream" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - grpclib "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" ) func TestIntegrationColdQuery(t *testing.T) { diff --git a/test/integration/other/measure_test.go b/test/integration/other/measure_test.go index 3ba7f4b..9f184fe 100644 --- a/test/integration/other/measure_test.go +++ b/test/integration/other/measure_test.go @@ -20,14 +20,14 @@ package integration_other_test import ( "time" - "github.com/apache/skywalking-banyandb/pkg/test/helpers" - "github.com/apache/skywalking-banyandb/pkg/test/setup" - "github.com/apache/skywalking-banyandb/pkg/timestamp" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" grpclib "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + "github.com/apache/skywalking-banyandb/pkg/test/helpers" + "github.com/apache/skywalking-banyandb/pkg/test/setup" + "github.com/apache/skywalking-banyandb/pkg/timestamp" cases_measure "github.com/apache/skywalking-banyandb/test/cases/measure/data" ) diff --git a/test/integration/other/other_suite_test.go b/test/integration/other/other_suite_test.go index 0225ce9..c3a9692 100644 --- a/test/integration/other/other_suite_test.go +++ b/test/integration/other/other_suite_test.go @@ -20,9 +20,10 @@ package integration_other_test import ( "testing" - "github.com/apache/skywalking-banyandb/pkg/logger" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + + "github.com/apache/skywalking-banyandb/pkg/logger" ) func TestIntegrationOther(t *testing.T) { diff --git a/test/integration/other/property_test.go b/test/integration/other/property_test.go index 07dbdfb..37282b7 100644 --- a/test/integration/other/property_test.go +++ b/test/integration/other/property_test.go @@ -20,7 +20,6 @@ package integration_other_test import ( "context" - "github.com/apache/skywalking-banyandb/pkg/test/setup" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" grpclib "google.golang.org/grpc" @@ -29,6 +28,7 @@ import ( common_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/common/v1" model_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1" property_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/property/v1" + "github.com/apache/skywalking-banyandb/pkg/test/setup" ) var _ = Describe("Property application", func() { diff --git a/test/integration/other/tls_test.go b/test/integration/other/tls_test.go index 607e7ca..4e2442c 100644 --- a/test/integration/other/tls_test.go +++ b/test/integration/other/tls_test.go @@ -22,14 +22,14 @@ import ( "runtime" "time" - "github.com/apache/skywalking-banyandb/pkg/test/helpers" - "github.com/apache/skywalking-banyandb/pkg/test/setup" - "github.com/apache/skywalking-banyandb/pkg/timestamp" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" grpclib "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "github.com/apache/skywalking-banyandb/pkg/test/helpers" + "github.com/apache/skywalking-banyandb/pkg/test/setup" + "github.com/apache/skywalking-banyandb/pkg/timestamp" cases_measure "github.com/apache/skywalking-banyandb/test/cases/measure/data" ) diff --git a/test/integration/query/query_suite_test.go b/test/integration/query/query_suite_test.go index 424334a..e37ca49 100644 --- a/test/integration/query/query_suite_test.go +++ b/test/integration/query/query_suite_test.go @@ -21,6 +21,11 @@ import ( "testing" "time" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + grpclib "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "github.com/apache/skywalking-banyandb/pkg/logger" "github.com/apache/skywalking-banyandb/pkg/test/helpers" "github.com/apache/skywalking-banyandb/pkg/test/setup" @@ -28,10 +33,6 @@ import ( cases_measure "github.com/apache/skywalking-banyandb/test/cases/measure" cases_measure_data "github.com/apache/skywalking-banyandb/test/cases/measure/data" cases_stream "github.com/apache/skywalking-banyandb/test/cases/stream" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - grpclib "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" ) func TestIntegrationQuery(t *testing.T) {
