From 69fcd50c0a2a48af3b347cdd1572233e69bb2259 Mon Sep 17 00:00:00 2001 From: "jesse.tang" <1430482733@qq.com> Date: Mon, 10 Oct 2022 11:27:01 +0800 Subject: [PATCH] feat: golangci add goimports local-prefixes (#2413) * feat: golangci goimports local-prefixes * fix lint * fix lint --- .golangci.yml | 2 ++ contrib/registry/servicecomb/registry.go | 2 +- contrib/registry/servicecomb/registry_test.go | 3 ++- contrib/registry/servicecomb/watcher.go | 2 +- transport/http/binding/encode.go | 3 ++- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 99d8b2ce6..06ee200c6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -67,3 +67,5 @@ linters-settings: gocyclo: # recommend 10-20 min-complexity: 50 + goimports: + local-prefixes: github.com/go-kratos/kratos # Put imports beginning with prefix after 3rd-party packages diff --git a/contrib/registry/servicecomb/registry.go b/contrib/registry/servicecomb/registry.go index 7a532396d..894cf343a 100644 --- a/contrib/registry/servicecomb/registry.go +++ b/contrib/registry/servicecomb/registry.go @@ -9,10 +9,10 @@ import ( "github.com/go-chassis/cari/discovery" "github.com/go-chassis/cari/pkg/errsvc" "github.com/go-chassis/sc-client" + "github.com/gofrs/uuid" "github.com/go-kratos/kratos/v2/log" "github.com/go-kratos/kratos/v2/registry" - "github.com/gofrs/uuid" ) func init() { diff --git a/contrib/registry/servicecomb/registry_test.go b/contrib/registry/servicecomb/registry_test.go index 85afe306c..4b4c25490 100644 --- a/contrib/registry/servicecomb/registry_test.go +++ b/contrib/registry/servicecomb/registry_test.go @@ -6,8 +6,9 @@ import ( pb "github.com/go-chassis/cari/discovery" "github.com/go-chassis/sc-client" - "github.com/go-kratos/kratos/v2/registry" "github.com/gofrs/uuid" + + "github.com/go-kratos/kratos/v2/registry" ) var r *Registry diff --git a/contrib/registry/servicecomb/watcher.go b/contrib/registry/servicecomb/watcher.go index 2b2117e81..b1f4fccfa 100644 --- a/contrib/registry/servicecomb/watcher.go +++ b/contrib/registry/servicecomb/watcher.go @@ -2,9 +2,9 @@ package servicecomb import ( "github.com/go-chassis/sc-client" + "golang.org/x/net/context" "github.com/go-kratos/kratos/v2/registry" - "golang.org/x/net/context" ) var _ registry.Watcher = (*Watcher)(nil) diff --git a/transport/http/binding/encode.go b/transport/http/binding/encode.go index 9bcdbeefd..72afd5085 100644 --- a/transport/http/binding/encode.go +++ b/transport/http/binding/encode.go @@ -4,8 +4,9 @@ import ( "reflect" "regexp" - "github.com/go-kratos/kratos/v2/encoding/form" "google.golang.org/protobuf/proto" + + "github.com/go-kratos/kratos/v2/encoding/form" ) var reg = regexp.MustCompile(`{[\\.\w]+}`)