This is an automated email from the ASF dual-hosted git repository.

tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git


The following commit(s) were added to refs/heads/master by this push:
     new bb60a6f  SCB-2176 BugFix: missing assertion failed (#1043)
bb60a6f is described below

commit bb60a6ff45eee15480b6a77269e2d6348d9d0427
Author: robotljw <790504...@qq.com>
AuthorDate: Tue Jun 8 19:33:25 2021 +0800

    SCB-2176 BugFix: missing assertion failed (#1043)
---
 client/apis.go                                     |  2 +-
 client/instance.go                                 |  2 +-
 client/microservice.go                             |  2 +-
 client/schema.go                                   |  2 +-
 client/watch.go                                    |  2 +-
 datasource/errortypes.go                           |  3 +-
 datasource/etcd/account.go                         |  6 +--
 datasource/etcd/event/dependency_event_handler.go  |  7 ++-
 datasource/etcd/event/instance_event_handler.go    | 10 ++++-
 datasource/etcd/event/service_event_handler.go     |  7 ++-
 datasource/etcd/ms.go                              |  2 +-
 datasource/etcd/sd/servicecenter/aggregate.go      |  3 +-
 datasource/etcd/sd/servicecenter/indexer.go        |  3 +-
 datasource/etcd/util.go                            |  2 +-
 datasource/etcd/util/heartbeat_util.go             |  3 +-
 datasource/etcd/util/instance_util.go              |  6 +--
 datasource/etcd/util/rule_util.go                  |  5 ++-
 datasource/etcd/util/tag_util.go                   |  4 +-
 datasource/mongo/account.go                        |  2 +-
 datasource/mongo/client/dao/instance.go            |  7 ++-
 datasource/mongo/client/mongo.go                   |  3 +-
 datasource/mongo/event/instance_event_handler.go   |  6 ++-
 .../mongo/event/schema_summary_event_handler.go    |  8 +++-
 datasource/mongo/event/service_event_handler.go    |  7 ++-
 datasource/mongo/ms.go                             |  2 +-
 datasource/mongo/role.go                           |  4 ++
 pkg/rest/util.go                                   |  5 ++-
 server/handler/auth/auth.go                        |  7 +--
 server/handler/exception/exception.go              |  3 +-
 server/plugin/auth/buildin/parser.go               | 11 ++---
 server/plugin/auth/buildin/service_parser.go       | 52 +++++++++++-----------
 server/plugin/quota/quota.go                       |  5 ++-
 server/resource/v4/auth_resource.go                | 10 ++---
 server/resource/v4/role_resource.go                |  8 ++--
 server/response/response.go                        | 13 +++---
 server/rest/govern/service.go                      |  2 +-
 server/service/dependency.go                       |  5 ++-
 server/service/instance.go                         |  4 +-
 server/service/microservice.go                     |  4 +-
 server/service/rbac/account_dao.go                 |  6 ++-
 server/service/rbac/authr_plugin.go                |  8 ++--
 server/service/rbac/blocker.go                     |  1 -
 server/service/rbac/context.go                     |  4 +-
 server/service/rbac/context_test.go                |  3 +-
 server/service/rbac/decision.go                    |  1 +
 server/service/rbac/password.go                    |  8 ++--
 server/service/rbac/permission.go                  |  3 +-
 server/service/rbac/rbac.go                        |  8 ++--
 server/service/rbac/role.go                        |  5 ++-
 server/service/rbac/role_dao.go                    |  7 +--
 server/service/rule.go                             |  5 ++-
 server/service/tag.go                              |  5 ++-
 server/service/validator/validator.go              |  6 ++-
 53 files changed, 184 insertions(+), 125 deletions(-)

diff --git a/client/apis.go b/client/apis.go
index 0c96b7f..2e0346a 100644
--- a/client/apis.go
+++ b/client/apis.go
@@ -18,11 +18,11 @@ package client
 import (
        "context"
        "encoding/json"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "io/ioutil"
        "net/http"
 
        "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
 
        "github.com/apache/servicecomb-service-center/pkg/cluster"
        "github.com/apache/servicecomb-service-center/pkg/dump"
diff --git a/client/instance.go b/client/instance.go
index ee7caf7..aa07e27 100644
--- a/client/instance.go
+++ b/client/instance.go
@@ -19,12 +19,12 @@ import (
        "context"
        "encoding/json"
        "fmt"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "io/ioutil"
        "net/http"
        "net/url"
 
        "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
 )
 
 const (
diff --git a/client/microservice.go b/client/microservice.go
index eae670b..4ae8d93 100644
--- a/client/microservice.go
+++ b/client/microservice.go
@@ -19,12 +19,12 @@ import (
        "context"
        "encoding/json"
        "fmt"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "io/ioutil"
        "net/http"
        "net/url"
 
        pb "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
 )
 
 const (
diff --git a/client/schema.go b/client/schema.go
index e87341d..b900ced 100644
--- a/client/schema.go
+++ b/client/schema.go
@@ -22,11 +22,11 @@ import (
        "crypto/sha256"
        "encoding/json"
        "fmt"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "io/ioutil"
        "net/http"
 
        pb "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
 )
 
 const (
diff --git a/client/watch.go b/client/watch.go
index 2372658..7b3b90a 100644
--- a/client/watch.go
+++ b/client/watch.go
@@ -19,10 +19,10 @@ import (
        "context"
        "encoding/json"
        "fmt"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "log"
 
        pb "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
        "github.com/gorilla/websocket"
 )
 
diff --git a/datasource/errortypes.go b/datasource/errortypes.go
index ffc6866..88564d5 100644
--- a/datasource/errortypes.go
+++ b/datasource/errortypes.go
@@ -18,5 +18,6 @@ package datasource
 import "errors"
 
 var (
-       ErrNoData = errors.New("no data found")
+       ErrNoData     = errors.New("no data found")
+       ErrAssertFail = errors.New("assertion failure")
 )
diff --git a/datasource/etcd/account.go b/datasource/etcd/account.go
index 487adea..6b92920 100644
--- a/datasource/etcd/account.go
+++ b/datasource/etcd/account.go
@@ -19,10 +19,12 @@ import (
        "context"
        "encoding/json"
        "fmt"
-       "github.com/go-chassis/foundation/stringutil"
        "strconv"
        "time"
 
+       "github.com/go-chassis/cari/rbac"
+       "github.com/go-chassis/foundation/stringutil"
+
        "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/datasource/etcd/client"
        "github.com/apache/servicecomb-service-center/datasource/etcd/path"
@@ -30,8 +32,6 @@ import (
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/privacy"
        "github.com/apache/servicecomb-service-center/pkg/util"
-
-       "github.com/go-chassis/cari/rbac"
 )
 
 func (ds *DataSource) CreateAccount(ctx context.Context, a *rbac.Account) 
error {
diff --git a/datasource/etcd/event/dependency_event_handler.go 
b/datasource/etcd/event/dependency_event_handler.go
index f68e2f3..c1cc6f5 100644
--- a/datasource/etcd/event/dependency_event_handler.go
+++ b/datasource/etcd/event/dependency_event_handler.go
@@ -25,6 +25,7 @@ import (
 
        pb "github.com/go-chassis/cari/discovery"
 
+       "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/datasource/etcd/client"
        "github.com/apache/servicecomb-service-center/datasource/etcd/kv"
        "github.com/apache/servicecomb-service-center/datasource/etcd/mux"
@@ -160,7 +161,11 @@ func (h *DependencyEventHandler) Handle() error {
        defer h.CleanUp(cleanUpDomainProjects)
 
        for _, keyValue := range resp.Kvs {
-               r := keyValue.Value.(*pb.ConsumerDependency)
+               r, ok := keyValue.Value.(*pb.ConsumerDependency)
+               if !ok {
+                       log.Error("failed to assert consumerDependency", 
datasource.ErrAssertFail)
+                       continue
+               }
 
                _, domainProject, uuid := 
path.GetInfoFromDependencyQueueKV(keyValue.Key)
                if uuid == path.DepsQueueUUID {
diff --git a/datasource/etcd/event/instance_event_handler.go 
b/datasource/etcd/event/instance_event_handler.go
index b247c2a..b6dd461 100644
--- a/datasource/etcd/event/instance_event_handler.go
+++ b/datasource/etcd/event/instance_event_handler.go
@@ -22,6 +22,9 @@ import (
        "fmt"
        "strings"
 
+       pb "github.com/go-chassis/cari/discovery"
+
+       "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/datasource/etcd/cache"
        "github.com/apache/servicecomb-service-center/datasource/etcd/kv"
        "github.com/apache/servicecomb-service-center/datasource/etcd/path"
@@ -34,7 +37,6 @@ import (
        "github.com/apache/servicecomb-service-center/server/event"
        "github.com/apache/servicecomb-service-center/server/metrics"
        "github.com/apache/servicecomb-service-center/server/syncernotify"
-       pb "github.com/go-chassis/cari/discovery"
 )
 
 const (
@@ -58,7 +60,11 @@ func (h *InstanceEventHandler) Type() sd.Type {
 
 func (h *InstanceEventHandler) OnEvent(evt sd.KvEvent) {
        action := evt.Type
-       instance := evt.KV.Value.(*pb.MicroServiceInstance)
+       instance, ok := evt.KV.Value.(*pb.MicroServiceInstance)
+       if !ok {
+               log.Error("failed to assert microServiceInstance", 
datasource.ErrAssertFail)
+               return
+       }
        providerID, providerInstanceID, domainProject := 
path.GetInfoFromInstKV(evt.KV.Key)
        idx := strings.Index(domainProject, "/")
        domainName := domainProject[:idx]
diff --git a/datasource/etcd/event/service_event_handler.go 
b/datasource/etcd/event/service_event_handler.go
index 0451165..b4ee26b 100644
--- a/datasource/etcd/event/service_event_handler.go
+++ b/datasource/etcd/event/service_event_handler.go
@@ -23,6 +23,7 @@ import (
 
        pb "github.com/go-chassis/cari/discovery"
 
+       "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/datasource/etcd/cache"
        "github.com/apache/servicecomb-service-center/datasource/etcd/kv"
        "github.com/apache/servicecomb-service-center/datasource/etcd/path"
@@ -44,7 +45,11 @@ func (h *ServiceEventHandler) Type() sd.Type {
 }
 
 func (h *ServiceEventHandler) OnEvent(evt sd.KvEvent) {
-       ms := evt.KV.Value.(*pb.MicroService)
+       ms, ok := evt.KV.Value.(*pb.MicroService)
+       if !ok {
+               log.Error("failed to assert MicroService", 
datasource.ErrAssertFail)
+               return
+       }
        _, domainProject := path.GetInfoFromSvcKV(evt.KV.Key)
        fn, fv := getFramework(ms)
 
diff --git a/datasource/etcd/ms.go b/datasource/etcd/ms.go
index 7fe51de..1784f72 100644
--- a/datasource/etcd/ms.go
+++ b/datasource/etcd/ms.go
@@ -22,11 +22,11 @@ import (
        "encoding/json"
        "errors"
        "fmt"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "strconv"
        "time"
 
        pb "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
        "github.com/jinzhu/copier"
 
        "github.com/apache/servicecomb-service-center/datasource"
diff --git a/datasource/etcd/sd/servicecenter/aggregate.go 
b/datasource/etcd/sd/servicecenter/aggregate.go
index a51cc23..c6d580f 100644
--- a/datasource/etcd/sd/servicecenter/aggregate.go
+++ b/datasource/etcd/sd/servicecenter/aggregate.go
@@ -18,10 +18,11 @@ package servicecenter
 import (
        "context"
        "crypto/tls"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "strings"
        "sync"
 
+       "github.com/go-chassis/cari/pkg/errsvc"
+
        "github.com/apache/servicecomb-service-center/client"
        "github.com/apache/servicecomb-service-center/datasource/etcd"
        etcdclient 
"github.com/apache/servicecomb-service-center/datasource/etcd/client"
diff --git a/datasource/etcd/sd/servicecenter/indexer.go 
b/datasource/etcd/sd/servicecenter/indexer.go
index 1704bc7..627d7b8 100644
--- a/datasource/etcd/sd/servicecenter/indexer.go
+++ b/datasource/etcd/sd/servicecenter/indexer.go
@@ -17,9 +17,10 @@ package servicecenter
 
 import (
        "context"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "strings"
 
+       "github.com/go-chassis/cari/pkg/errsvc"
+
        "github.com/apache/servicecomb-service-center/client"
        etcdclient 
"github.com/apache/servicecomb-service-center/datasource/etcd/client"
        "github.com/apache/servicecomb-service-center/datasource/etcd/kv"
diff --git a/datasource/etcd/util.go b/datasource/etcd/util.go
index 4ee8f4b..13a64d6 100644
--- a/datasource/etcd/util.go
+++ b/datasource/etcd/util.go
@@ -19,12 +19,12 @@ package etcd
 
 import (
        "context"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "strconv"
        "strings"
        "time"
 
        pb "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
 
        "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/datasource/etcd/client"
diff --git a/datasource/etcd/util/heartbeat_util.go 
b/datasource/etcd/util/heartbeat_util.go
index dca7ae4..2ea0f19 100644
--- a/datasource/etcd/util/heartbeat_util.go
+++ b/datasource/etcd/util/heartbeat_util.go
@@ -20,11 +20,12 @@ package util
 import (
        "context"
        "errors"
+
+       "github.com/go-chassis/cari/discovery"
        "github.com/go-chassis/cari/pkg/errsvc"
 
        "github.com/apache/servicecomb-service-center/datasource/etcd/client"
        "github.com/apache/servicecomb-service-center/datasource/etcd/path"
-       "github.com/go-chassis/cari/discovery"
 )
 
 func HeartbeatUtil(ctx context.Context, domainProject string, serviceID 
string, instanceID string) (leaseID int64, ttl int64, _ *errsvc.Error) {
diff --git a/datasource/etcd/util/instance_util.go 
b/datasource/etcd/util/instance_util.go
index d297df5..a51a62d 100644
--- a/datasource/etcd/util/instance_util.go
+++ b/datasource/etcd/util/instance_util.go
@@ -22,19 +22,19 @@ import (
        "crypto/sha1"
        "encoding/json"
        "fmt"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "strconv"
        "strings"
        "time"
 
-       "github.com/apache/servicecomb-service-center/datasource/etcd/path"
+       pb "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
 
        "github.com/apache/servicecomb-service-center/datasource/etcd/client"
        "github.com/apache/servicecomb-service-center/datasource/etcd/kv"
+       "github.com/apache/servicecomb-service-center/datasource/etcd/path"
        "github.com/apache/servicecomb-service-center/datasource/etcd/sd"
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/util"
-       pb "github.com/go-chassis/cari/discovery"
 )
 
 func GetLeaseID(ctx context.Context, domainProject string, serviceID string, 
instanceID string) (int64, error) {
diff --git a/datasource/etcd/util/rule_util.go 
b/datasource/etcd/util/rule_util.go
index 1812720..6588820 100644
--- a/datasource/etcd/util/rule_util.go
+++ b/datasource/etcd/util/rule_util.go
@@ -21,11 +21,13 @@ import (
        "context"
        "errors"
        "fmt"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "reflect"
        "regexp"
        "strings"
 
+       "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
+
        "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/datasource/etcd/client"
        "github.com/apache/servicecomb-service-center/datasource/etcd/kv"
@@ -33,7 +35,6 @@ import (
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/util"
        apt "github.com/apache/servicecomb-service-center/server/core"
-       "github.com/go-chassis/cari/discovery"
 )
 
 type RuleFilter struct {
diff --git a/datasource/etcd/util/tag_util.go b/datasource/etcd/util/tag_util.go
index 906c50e..59264fe 100644
--- a/datasource/etcd/util/tag_util.go
+++ b/datasource/etcd/util/tag_util.go
@@ -20,13 +20,13 @@ package util
 import (
        "context"
        "encoding/json"
-       "github.com/go-chassis/cari/pkg/errsvc"
 
-       "github.com/apache/servicecomb-service-center/datasource/etcd/path"
        "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
 
        "github.com/apache/servicecomb-service-center/datasource/etcd/client"
        "github.com/apache/servicecomb-service-center/datasource/etcd/kv"
+       "github.com/apache/servicecomb-service-center/datasource/etcd/path"
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/util"
 )
diff --git a/datasource/mongo/account.go b/datasource/mongo/account.go
index 0d297cc..d7498ac 100644
--- a/datasource/mongo/account.go
+++ b/datasource/mongo/account.go
@@ -20,9 +20,9 @@ package mongo
 import (
        "context"
        "fmt"
-       "go.mongodb.org/mongo-driver/mongo"
 
        "github.com/go-chassis/cari/rbac"
+       "go.mongodb.org/mongo-driver/mongo"
 
        "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/datasource/mongo/client"
diff --git a/datasource/mongo/client/dao/instance.go 
b/datasource/mongo/client/dao/instance.go
index a879f7f..daacd6d 100644
--- a/datasource/mongo/client/dao/instance.go
+++ b/datasource/mongo/client/dao/instance.go
@@ -19,16 +19,15 @@ package dao
 
 import (
        "context"
-       "github.com/go-chassis/cari/pkg/errsvc"
-
-       mutil 
"github.com/apache/servicecomb-service-center/datasource/mongo/util"
-       "go.mongodb.org/mongo-driver/bson"
 
        "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
+       "go.mongodb.org/mongo-driver/bson"
        "go.mongodb.org/mongo-driver/mongo/options"
 
        "github.com/apache/servicecomb-service-center/datasource/mongo/client"
        
"github.com/apache/servicecomb-service-center/datasource/mongo/client/model"
+       mutil 
"github.com/apache/servicecomb-service-center/datasource/mongo/util"
 )
 
 func GetInstance(ctx context.Context, filter interface{}) (*model.Instance, 
error) {
diff --git a/datasource/mongo/client/mongo.go b/datasource/mongo/client/mongo.go
index 55dec95..ec7ee0c 100644
--- a/datasource/mongo/client/mongo.go
+++ b/datasource/mongo/client/mongo.go
@@ -109,13 +109,12 @@ func (mc *MongoClient) ExecTxn(ctx context.Context, cmd 
func(sessionContext mong
                        if err = session.AbortTransaction(sc); err != nil {
                                return err
                        }
-                       return nil
                } else {
                        if err = session.CommitTransaction(sc); err != nil {
                                return err
                        }
-                       return nil
                }
+               return nil
        }); err != nil {
                return err
        }
diff --git a/datasource/mongo/event/instance_event_handler.go 
b/datasource/mongo/event/instance_event_handler.go
index a32c5ce..691e07d 100644
--- a/datasource/mongo/event/instance_event_handler.go
+++ b/datasource/mongo/event/instance_event_handler.go
@@ -53,7 +53,11 @@ func (h InstanceEventHandler) OnEvent(evt sd.MongoEvent) {
        if evt.Type == discovery.EVT_UPDATE {
                return
        }
-       instance := evt.Value.(model.Instance)
+       instance, ok := evt.Value.(model.Instance)
+       if !ok {
+               log.Error("failed to assert instance", datasource.ErrAssertFail)
+               return
+       }
        providerID := instance.Instance.ServiceId
        providerInstanceID := instance.Instance.InstanceId
        domainProject := instance.Domain + "/" + instance.Project
diff --git a/datasource/mongo/event/schema_summary_event_handler.go 
b/datasource/mongo/event/schema_summary_event_handler.go
index e37bd81..ad79856 100644
--- a/datasource/mongo/event/schema_summary_event_handler.go
+++ b/datasource/mongo/event/schema_summary_event_handler.go
@@ -20,8 +20,10 @@ package event
 import (
        pb "github.com/go-chassis/cari/discovery"
 
+       "github.com/apache/servicecomb-service-center/datasource"
        
"github.com/apache/servicecomb-service-center/datasource/mongo/client/model"
        "github.com/apache/servicecomb-service-center/datasource/mongo/sd"
+       "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/server/metrics"
 )
 
@@ -37,7 +39,11 @@ func (h *SchemaSummaryEventHandler) Type() string {
 }
 
 func (h *SchemaSummaryEventHandler) OnEvent(evt sd.MongoEvent) {
-       schema := evt.Value.(model.Schema)
+       schema, ok := evt.Value.(model.Schema)
+       if !ok {
+               log.Error("failed to assert schema", datasource.ErrAssertFail)
+               return
+       }
        action := evt.Type
        switch action {
        case pb.EVT_INIT, pb.EVT_CREATE:
diff --git a/datasource/mongo/event/service_event_handler.go 
b/datasource/mongo/event/service_event_handler.go
index 20e3fb9..6e32136 100644
--- a/datasource/mongo/event/service_event_handler.go
+++ b/datasource/mongo/event/service_event_handler.go
@@ -23,6 +23,7 @@ import (
 
        pb "github.com/go-chassis/cari/discovery"
 
+       "github.com/apache/servicecomb-service-center/datasource"
        
"github.com/apache/servicecomb-service-center/datasource/mongo/client/dao"
        
"github.com/apache/servicecomb-service-center/datasource/mongo/client/model"
        "github.com/apache/servicecomb-service-center/datasource/mongo/sd"
@@ -42,7 +43,11 @@ func (h *ServiceEventHandler) Type() string {
        return model.ColumnService
 }
 func (h *ServiceEventHandler) OnEvent(evt sd.MongoEvent) {
-       ms := evt.Value.(model.Service)
+       ms, ok := evt.Value.(model.Service)
+       if !ok {
+               log.Error("failed to assert service", datasource.ErrAssertFail)
+               return
+       }
        fn, fv := getFramework(ms.Service)
        switch evt.Type {
        case pb.EVT_INIT, pb.EVT_CREATE:
diff --git a/datasource/mongo/ms.go b/datasource/mongo/ms.go
index 9274d90..724dd11 100644
--- a/datasource/mongo/ms.go
+++ b/datasource/mongo/ms.go
@@ -23,7 +23,6 @@ import (
        "encoding/json"
        "errors"
        "fmt"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "reflect"
        "regexp"
        "sort"
@@ -32,6 +31,7 @@ import (
        "time"
 
        "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
        "github.com/jinzhu/copier"
        "go.mongodb.org/mongo-driver/bson"
        "go.mongodb.org/mongo-driver/mongo"
diff --git a/datasource/mongo/role.go b/datasource/mongo/role.go
index c4ab393..b22c211 100644
--- a/datasource/mongo/role.go
+++ b/datasource/mongo/role.go
@@ -19,6 +19,7 @@ package mongo
 
 import (
        "context"
+
        "github.com/go-chassis/cari/rbac"
        "go.mongodb.org/mongo-driver/bson"
 
@@ -103,6 +104,9 @@ func (ds *DataSource) ListRole(ctx context.Context) 
([]*rbac.Role, int64, error)
 
 func (ds *DataSource) DeleteRole(ctx context.Context, name string) (bool, 
error) {
        n, err := client.Count(ctx, model.CollectionAccount, bson.M{"roles": 
bson.M{"$in": []string{name}}})
+       if err != nil {
+               return false, err
+       }
        if n > 0 {
                return false, datasource.ErrRoleBindingExist
        }
diff --git a/pkg/rest/util.go b/pkg/rest/util.go
index 142ef12..91c2a13 100644
--- a/pkg/rest/util.go
+++ b/pkg/rest/util.go
@@ -22,12 +22,13 @@ import (
        "encoding/json"
        "errors"
        "io/ioutil"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "net/http"
 
+       "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
+
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/util"
-       "github.com/go-chassis/cari/discovery"
 )
 
 var errNilRequestBody = errors.New("request body is nil")
diff --git a/server/handler/auth/auth.go b/server/handler/auth/auth.go
index 9e693e4..9d836a8 100644
--- a/server/handler/auth/auth.go
+++ b/server/handler/auth/auth.go
@@ -18,17 +18,18 @@
 package auth
 
 import (
-       "github.com/go-chassis/cari/pkg/errsvc"
        "net/http"
 
+       "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
+       "github.com/go-chassis/cari/rbac"
+
        "github.com/apache/servicecomb-service-center/pkg/chain"
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/rest"
        "github.com/apache/servicecomb-service-center/pkg/util"
        "github.com/apache/servicecomb-service-center/server/plugin/auth"
        "github.com/apache/servicecomb-service-center/server/response"
-       "github.com/go-chassis/cari/discovery"
-       "github.com/go-chassis/cari/rbac"
 )
 
 const (
diff --git a/server/handler/exception/exception.go 
b/server/handler/exception/exception.go
index b46b837..9d2e216 100644
--- a/server/handler/exception/exception.go
+++ b/server/handler/exception/exception.go
@@ -20,9 +20,10 @@ package exception
 import (
        "encoding/json"
        "fmt"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "net/http"
 
+       "github.com/go-chassis/cari/pkg/errsvc"
+
        "github.com/apache/servicecomb-service-center/pkg/chain"
        "github.com/apache/servicecomb-service-center/pkg/errors"
        "github.com/apache/servicecomb-service-center/pkg/log"
diff --git a/server/plugin/auth/buildin/parser.go 
b/server/plugin/auth/buildin/parser.go
index 1cd3e71..e7cf94f 100644
--- a/server/plugin/auth/buildin/parser.go
+++ b/server/plugin/auth/buildin/parser.go
@@ -19,14 +19,15 @@ package buildin
 
 import (
        "errors"
-       "fmt"
+       "net/http"
+       "strings"
+
+       rbacmodel "github.com/go-chassis/cari/rbac"
+
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/rest"
        "github.com/apache/servicecomb-service-center/server/plugin/auth"
        "github.com/apache/servicecomb-service-center/server/service/rbac"
-       rbacmodel "github.com/go-chassis/cari/rbac"
-       "net/http"
-       "strings"
 )
 
 var ErrCtxMatchPatternNotFound = errors.New("CtxMatchPattern not found")
@@ -57,7 +58,7 @@ func FromRequest(r *http.Request) *auth.ResourceScope {
 
        resource, err := GetAPIParseFunc(apiPath)(r)
        if err != nil {
-               log.Error(fmt.Sprintf("parse from request failed"), err)
+               log.Error("parse from request failed", err)
        }
        return resource
 }
diff --git a/server/plugin/auth/buildin/service_parser.go 
b/server/plugin/auth/buildin/service_parser.go
index c0ae548..b69073d 100644
--- a/server/plugin/auth/buildin/service_parser.go
+++ b/server/plugin/auth/buildin/service_parser.go
@@ -21,40 +21,42 @@ import (
        "context"
        "encoding/json"
        "fmt"
+       "net/http"
+
+       "github.com/go-chassis/cari/discovery"
+       rbacmodel "github.com/go-chassis/cari/rbac"
+
        "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/pkg/rest"
        "github.com/apache/servicecomb-service-center/server/plugin/auth"
        "github.com/apache/servicecomb-service-center/server/service/rbac"
-       "github.com/go-chassis/cari/discovery"
-       rbacmodel "github.com/go-chassis/cari/rbac"
-       "net/http"
 )
 
 const (
        LabelEnvironment = "environment"
-       LabelAppId       = "appId"
+       LabelAppID       = "appId"
        LabelServiceName = "serviceName"
        QueryEnv         = "env"
 )
 
 var (
-       // Apply by service key or serviceId
+       // APIServiceExistence Apply by service key or serviceId
        // - /v4/:project/registry/existence?env=xxx&appId=xxx&serviceName=xxx
        // - /v4/:project/registry/existence?serviceId=xxx&schemaId=xxx
        APIServiceExistence = "/v4/:project/registry/existence"
-       // Method GET: apply all by optional service key
+       // APIServicesList Method GET: apply all by optional service key
        // Method POST or DELETE: apply by request body
        APIServicesList     = "/v4/:project/registry/microservices"
        APIServiceInfo      = "/v4/:project/registry/microservices/:serviceId"
        APIProConDependency = 
"/v4/:project/registry/microservices/:providerId/consumers"
        APIConProDependency = 
"/v4/:project/registry/microservices/:consumerId/providers"
-       // Apply by service key
+       // APIDiscovery Apply by service key
        APIDiscovery = "/v4/:project/registry/instances"
-       // Apply by request body
+       // APIBatchDiscovery Apply by request body
        APIBatchDiscovery = "/v4/:project/registry/instances/action"
-       // Apply by request body
+       // APIHeartbeats Apply by request body
        APIHeartbeats = "/v4/:project/registry/heartbeats"
-       // Apply by optional service key
+       // APIGovServicesList Apply by optional service key
        // - /v4/:project/govern/microservices?appId=xxx
        // Apply all:
        // - /v4/:project/govern/microservices?options=statistics
@@ -64,8 +66,8 @@ var (
 )
 
 func init() {
-       RegisterParseFunc(APIServiceInfo, ByServiceId)
-       RegisterParseFunc(APIGovServiceInfo, ByServiceId)
+       RegisterParseFunc(APIServiceInfo, ByServiceID)
+       RegisterParseFunc(APIGovServiceInfo, ByServiceID)
        RegisterParseFunc(APIProConDependency, func(r *http.Request) 
(*auth.ResourceScope, error) {
                return fromQueryKey(r, ":providerId")
        })
@@ -80,7 +82,7 @@ func init() {
        RegisterParseFunc(APIHeartbeats, ByHeartbeatRequestBody)
 }
 
-func ByServiceId(r *http.Request) (*auth.ResourceScope, error) {
+func ByServiceID(r *http.Request) (*auth.ResourceScope, error) {
        return fromQueryKey(r, ":serviceId")
 }
 func fromQueryKey(r *http.Request, queryKey string) (*auth.ResourceScope, 
error) {
@@ -89,8 +91,8 @@ func fromQueryKey(r *http.Request, queryKey string) 
(*auth.ResourceScope, error)
        if !ok {
                return nil, ErrCtxMatchPatternNotFound
        }
-       serviceId := r.URL.Query().Get(queryKey)
-       labels, err := serviceIdToLabels(ctx, serviceId)
+       serviceID := r.URL.Query().Get(queryKey)
+       labels, err := serviceIDToLabels(ctx, serviceID)
        if err != nil {
                return nil, err
        }
@@ -100,20 +102,20 @@ func fromQueryKey(r *http.Request, queryKey string) 
(*auth.ResourceScope, error)
                Verb:   rbac.MethodToVerbs[r.Method],
        }, nil
 }
-func serviceIdToLabels(ctx context.Context, serviceId string) 
([]map[string]string, error) {
-       response, err := datasource.Instance().GetService(ctx, 
&discovery.GetServiceRequest{ServiceId: serviceId})
+func serviceIDToLabels(ctx context.Context, serviceID string) 
([]map[string]string, error) {
+       response, err := datasource.Instance().GetService(ctx, 
&discovery.GetServiceRequest{ServiceId: serviceID})
        if err != nil {
                return nil, err
        }
 
        service := response.Service
        if service == nil {
-               return nil, fmt.Errorf("resource %s not found", serviceId)
+               return nil, fmt.Errorf("resource %s not found", serviceID)
        }
 
        return []map[string]string{{
                LabelEnvironment: service.Environment,
-               LabelAppId:       service.AppId,
+               LabelAppID:       service.AppId,
                LabelServiceName: service.ServiceName,
        }}, nil
 }
@@ -134,7 +136,7 @@ func ByServiceKey(r *http.Request) (*auth.ResourceScope, 
error) {
                Type: rbacmodel.GetResource(apiPath),
                Labels: []map[string]string{{
                        LabelEnvironment: query.Get(QueryEnv),
-                       LabelAppId:       query.Get(LabelAppId),
+                       LabelAppID:       query.Get(LabelAppID),
                        LabelServiceName: query.Get(LabelServiceName),
                }},
                Verb: rbac.MethodToVerbs[r.Method],
@@ -194,7 +196,7 @@ func createServiceToLabels(r *http.Request) 
([]map[string]string, error) {
 
        return []map[string]string{{
                LabelEnvironment: service.Environment,
-               LabelAppId:       service.AppId,
+               LabelAppID:       service.AppId,
                LabelServiceName: service.ServiceName,
        }}, nil
 }
@@ -213,8 +215,8 @@ func deleteServicesToLabels(r *http.Request) 
([]map[string]string, error) {
 
        ctx := r.Context()
        var labels []map[string]string
-       for _, serviceId := range request.ServiceIds {
-               ls, err := serviceIdToLabels(ctx, serviceId)
+       for _, serviceID := range request.ServiceIds {
+               ls, err := serviceIDToLabels(ctx, serviceID)
                if err != nil {
                        return nil, err
                }
@@ -244,7 +246,7 @@ func ByDiscoveryRequestBody(r *http.Request) 
(*auth.ResourceScope, error) {
        ctx := r.Context()
        var labels []map[string]string
        for _, it := range request.Instances {
-               ls, err := serviceIdToLabels(ctx, it.Instance.ServiceId)
+               ls, err := serviceIDToLabels(ctx, it.Instance.ServiceId)
                if err != nil {
                        return nil, err
                }
@@ -279,7 +281,7 @@ func ByHeartbeatRequestBody(r *http.Request) 
(*auth.ResourceScope, error) {
        ctx := r.Context()
        var labels []map[string]string
        for _, instance := range request.Instances {
-               ls, err := serviceIdToLabels(ctx, instance.ServiceId)
+               ls, err := serviceIDToLabels(ctx, instance.ServiceId)
                if err != nil {
                        return nil, err
                }
diff --git a/server/plugin/quota/quota.go b/server/plugin/quota/quota.go
index 6313f8b..b8f0b17 100644
--- a/server/plugin/quota/quota.go
+++ b/server/plugin/quota/quota.go
@@ -21,16 +21,17 @@ import (
        "context"
        "errors"
        "fmt"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "strconv"
 
+       pb "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
+
        "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/plugin"
        "github.com/apache/servicecomb-service-center/pkg/util"
        "github.com/apache/servicecomb-service-center/server/config"
        "github.com/apache/servicecomb-service-center/server/metrics"
-       pb "github.com/go-chassis/cari/discovery"
 )
 
 const QUOTA plugin.Kind = "quota"
diff --git a/server/resource/v4/auth_resource.go 
b/server/resource/v4/auth_resource.go
index 6b3042f..9fb05f2 100644
--- a/server/resource/v4/auth_resource.go
+++ b/server/resource/v4/auth_resource.go
@@ -19,19 +19,19 @@ package v4
 
 import (
        "encoding/json"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "io/ioutil"
        "net/http"
 
+       "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
+       "github.com/go-chassis/cari/rbac"
+       "github.com/go-chassis/go-chassis/v2/security/authr"
+
        errorsEx "github.com/apache/servicecomb-service-center/pkg/errors"
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/rest"
        rbacsvc 
"github.com/apache/servicecomb-service-center/server/service/rbac"
        "github.com/apache/servicecomb-service-center/server/service/validator"
-
-       "github.com/go-chassis/cari/discovery"
-       "github.com/go-chassis/cari/rbac"
-       "github.com/go-chassis/go-chassis/v2/security/authr"
 )
 
 type AuthResource struct {
diff --git a/server/resource/v4/role_resource.go 
b/server/resource/v4/role_resource.go
index 2c92ce2..fa4af0a 100644
--- a/server/resource/v4/role_resource.go
+++ b/server/resource/v4/role_resource.go
@@ -19,16 +19,16 @@ package v4
 
 import (
        "encoding/json"
-       rbacsvc 
"github.com/apache/servicecomb-service-center/server/service/rbac"
        "io/ioutil"
        "net/http"
 
+       "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/rbac"
+
        errorsEx "github.com/apache/servicecomb-service-center/pkg/errors"
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/rest"
-
-       "github.com/go-chassis/cari/discovery"
-       "github.com/go-chassis/cari/rbac"
+       rbacsvc 
"github.com/apache/servicecomb-service-center/server/service/rbac"
 )
 
 var ErrConflictRole int32 = 409002
diff --git a/server/response/response.go b/server/response/response.go
index 74515a0..41ffdf3 100644
--- a/server/response/response.go
+++ b/server/response/response.go
@@ -18,8 +18,9 @@
 package response
 
 import (
-       "github.com/apache/servicecomb-service-center/pkg/util"
        "github.com/go-chassis/cari/discovery"
+
+       "github.com/apache/servicecomb-service-center/pkg/util"
 )
 
 func init() {
@@ -28,7 +29,7 @@ func init() {
        
RegisterFilter("/v4/:project/registry/microservices/:consumerId/providers", 
ConsumersListFilter)
        // control panel apis
        RegisterFilter("/v4/:project/govern/microservices", 
MicroServiceInfoListFilter)
-       RegisterFilter("/v4/:project/govern/apps", AppIdListFilter)
+       RegisterFilter("/v4/:project/govern/apps", AppIDListFilter)
 }
 
 func MicroserviceListFilter(obj interface{}, labels []map[string]string) 
interface{} {
@@ -104,18 +105,18 @@ func MicroServiceInfoListFilter(obj interface{}, 
labelsList []map[string]string)
        return servicesResponse
 }
 
-func AppIdListFilter(obj interface{}, labelsList []map[string]string) 
interface{} {
+func AppIDListFilter(obj interface{}, labelsList []map[string]string) 
interface{} {
        appsResponse, ok := obj.(*discovery.GetAppsResponse)
        if !ok {
                return obj
        }
        var apps []string
-       for _, appId := range appsResponse.AppIds {
+       for _, appID := range appsResponse.AppIds {
                for _, labels := range labelsList {
-                       if app, ok := labels["appId"]; ok && appId != app {
+                       if app, ok := labels["appId"]; ok && appID != app {
                                continue
                        }
-                       apps = append(apps, appId)
+                       apps = append(apps, appID)
                        break
                }
        }
diff --git a/server/rest/govern/service.go b/server/rest/govern/service.go
index 4c35b1a..5b82f2b 100644
--- a/server/rest/govern/service.go
+++ b/server/rest/govern/service.go
@@ -19,13 +19,13 @@ package govern
 
 import (
        "context"
-       "github.com/apache/servicecomb-service-center/server/service/validator"
 
        pb "github.com/go-chassis/cari/discovery"
 
        "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/pkg/proto"
        "github.com/apache/servicecomb-service-center/pkg/util"
+       "github.com/apache/servicecomb-service-center/server/service/validator"
 )
 
 var ServiceAPI proto.GovernServiceCtrlServer = &Service{}
diff --git a/server/service/dependency.go b/server/service/dependency.go
index 467cdd0..cb7fe47 100644
--- a/server/service/dependency.go
+++ b/server/service/dependency.go
@@ -19,11 +19,12 @@ package service
 
 import (
        "context"
-       "github.com/apache/servicecomb-service-center/server/service/validator"
+
+       pb "github.com/go-chassis/cari/discovery"
 
        "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/pkg/log"
-       pb "github.com/go-chassis/cari/discovery"
+       "github.com/apache/servicecomb-service-center/server/service/validator"
 )
 
 func (s *MicroServiceService) AddDependenciesForMicroServices(ctx 
context.Context,
diff --git a/server/service/instance.go b/server/service/instance.go
index 303ac7b..34ebce3 100644
--- a/server/service/instance.go
+++ b/server/service/instance.go
@@ -21,10 +21,9 @@ import (
        "context"
        "errors"
        "fmt"
-       "github.com/apache/servicecomb-service-center/server/service/validator"
-       "github.com/go-chassis/cari/pkg/errsvc"
 
        pb "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
 
        "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/pkg/log"
@@ -32,6 +31,7 @@ import (
        apt "github.com/apache/servicecomb-service-center/server/core"
        "github.com/apache/servicecomb-service-center/server/health"
        "github.com/apache/servicecomb-service-center/server/plugin/quota"
+       "github.com/apache/servicecomb-service-center/server/service/validator"
 )
 
 type InstanceService struct {
diff --git a/server/service/microservice.go b/server/service/microservice.go
index 4906fb8..4709a6e 100644
--- a/server/service/microservice.go
+++ b/server/service/microservice.go
@@ -20,10 +20,9 @@ package service
 import (
        "context"
        "fmt"
-       "github.com/apache/servicecomb-service-center/server/service/validator"
-       "github.com/go-chassis/cari/pkg/errsvc"
 
        pb "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/pkg/errsvc"
 
        "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/pkg/gopool"
@@ -32,6 +31,7 @@ import (
        "github.com/apache/servicecomb-service-center/pkg/util"
        "github.com/apache/servicecomb-service-center/server/core"
        "github.com/apache/servicecomb-service-center/server/plugin/quota"
+       "github.com/apache/servicecomb-service-center/server/service/validator"
 )
 
 type MicroServiceService struct {
diff --git a/server/service/rbac/account_dao.go 
b/server/service/rbac/account_dao.go
index befd20b..12bf9b0 100644
--- a/server/service/rbac/account_dao.go
+++ b/server/service/rbac/account_dao.go
@@ -21,14 +21,16 @@ package rbac
 import (
        "context"
        "fmt"
+
+       "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/rbac"
+
        "github.com/apache/servicecomb-service-center/datasource"
        errorsEx "github.com/apache/servicecomb-service-center/pkg/errors"
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/util"
        "github.com/apache/servicecomb-service-center/server/plugin/quota"
        "github.com/apache/servicecomb-service-center/server/service/validator"
-       "github.com/go-chassis/cari/discovery"
-       "github.com/go-chassis/cari/rbac"
 )
 
 //CreateAccount save 2 kv
diff --git a/server/service/rbac/authr_plugin.go 
b/server/service/rbac/authr_plugin.go
index 5d90d41..810c6da 100644
--- a/server/service/rbac/authr_plugin.go
+++ b/server/service/rbac/authr_plugin.go
@@ -22,17 +22,17 @@ import (
        "crypto/rsa"
        "errors"
        "fmt"
-       "github.com/apache/servicecomb-service-center/datasource"
-       "github.com/apache/servicecomb-service-center/pkg/util"
-       "github.com/go-chassis/cari/pkg/errsvc"
-       "github.com/go-chassis/cari/rbac"
 
        "github.com/dgrijalva/jwt-go"
+       "github.com/go-chassis/cari/pkg/errsvc"
+       "github.com/go-chassis/cari/rbac"
        "github.com/go-chassis/go-chassis/v2/security/authr"
        "github.com/go-chassis/go-chassis/v2/security/token"
 
+       "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/privacy"
+       "github.com/apache/servicecomb-service-center/pkg/util"
 )
 
 var ErrUnauthorized = errors.New("wrong user name or password")
diff --git a/server/service/rbac/blocker.go b/server/service/rbac/blocker.go
index 9060b39..dce5053 100644
--- a/server/service/rbac/blocker.go
+++ b/server/service/rbac/blocker.go
@@ -99,4 +99,3 @@ func IsBanned(key string) bool {
        }
        return client.Banned
 }
-
diff --git a/server/service/rbac/context.go b/server/service/rbac/context.go
index f00e51a..500fc25 100644
--- a/server/service/rbac/context.go
+++ b/server/service/rbac/context.go
@@ -20,8 +20,10 @@ package rbac
 import (
        "context"
        "errors"
-       "github.com/apache/servicecomb-service-center/pkg/util"
+
        rbacmodel "github.com/go-chassis/cari/rbac"
+
+       "github.com/apache/servicecomb-service-center/pkg/util"
 )
 
 const CtxRequestClaims util.CtxKey = "_request_claims"
diff --git a/server/service/rbac/context_test.go 
b/server/service/rbac/context_test.go
index 0616b9c..157ed21 100644
--- a/server/service/rbac/context_test.go
+++ b/server/service/rbac/context_test.go
@@ -19,8 +19,9 @@ package rbac_test
 
 import (
        "context"
-       rbacsvc 
"github.com/apache/servicecomb-service-center/server/service/rbac"
        "testing"
+
+       rbacsvc 
"github.com/apache/servicecomb-service-center/server/service/rbac"
 )
 
 func TestUserFromContext(t *testing.T) {
diff --git a/server/service/rbac/decision.go b/server/service/rbac/decision.go
index 52bf54c..96054e7 100644
--- a/server/service/rbac/decision.go
+++ b/server/service/rbac/decision.go
@@ -19,6 +19,7 @@ package rbac
 
 import (
        "context"
+
        "github.com/go-chassis/cari/rbac"
 
        "github.com/apache/servicecomb-service-center/datasource"
diff --git a/server/service/rbac/password.go b/server/service/rbac/password.go
index bbe72db..856058f 100644
--- a/server/service/rbac/password.go
+++ b/server/service/rbac/password.go
@@ -19,16 +19,16 @@ package rbac
 
 import (
        "context"
-       "github.com/apache/servicecomb-service-center/pkg/privacy"
-       "github.com/apache/servicecomb-service-center/pkg/util"
-       "github.com/apache/servicecomb-service-center/server/service/validator"
+
        "github.com/go-chassis/cari/discovery"
        "github.com/go-chassis/cari/rbac"
-
        "github.com/go-chassis/foundation/stringutil"
        "golang.org/x/crypto/bcrypt"
 
        "github.com/apache/servicecomb-service-center/pkg/log"
+       "github.com/apache/servicecomb-service-center/pkg/privacy"
+       "github.com/apache/servicecomb-service-center/pkg/util"
+       "github.com/apache/servicecomb-service-center/server/service/validator"
 )
 
 func ChangePassword(ctx context.Context, a *rbac.Account) error {
diff --git a/server/service/rbac/permission.go 
b/server/service/rbac/permission.go
index bc511c4..e229bb1 100644
--- a/server/service/rbac/permission.go
+++ b/server/service/rbac/permission.go
@@ -18,8 +18,9 @@
 package rbac
 
 import (
-       "github.com/go-chassis/cari/rbac"
        "net/http"
+
+       "github.com/go-chassis/cari/rbac"
 )
 
 // method to verbs
diff --git a/server/service/rbac/rbac.go b/server/service/rbac/rbac.go
index 74f59f3..d3398ff 100644
--- a/server/service/rbac/rbac.go
+++ b/server/service/rbac/rbac.go
@@ -21,17 +21,17 @@ import (
        "context"
        "crypto/rsa"
        "errors"
-       "github.com/go-chassis/cari/pkg/errsvc"
        "io/ioutil"
 
+       "github.com/go-chassis/cari/pkg/errsvc"
        "github.com/go-chassis/cari/rbac"
+       "github.com/go-chassis/go-archaius"
+       "github.com/go-chassis/go-chassis/v2/security/authr"
+       "github.com/go-chassis/go-chassis/v2/security/secret"
 
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/server/config"
        
"github.com/apache/servicecomb-service-center/server/plugin/security/cipher"
-       "github.com/go-chassis/go-archaius"
-       "github.com/go-chassis/go-chassis/v2/security/authr"
-       "github.com/go-chassis/go-chassis/v2/security/secret"
 )
 
 const (
diff --git a/server/service/rbac/role.go b/server/service/rbac/role.go
index eea598e..f9ee4a9 100644
--- a/server/service/rbac/role.go
+++ b/server/service/rbac/role.go
@@ -19,9 +19,11 @@ package rbac
 
 import (
        "context"
-       "github.com/apache/servicecomb-service-center/pkg/log"
+
        "github.com/go-chassis/cari/pkg/errsvc"
        "github.com/go-chassis/cari/rbac"
+
+       "github.com/apache/servicecomb-service-center/pkg/log"
 )
 
 var roleMap = map[string]*rbac.Role{}
@@ -64,5 +66,4 @@ func createBuildInRole(r *rbac.Role) {
                return
        }
        log.Fatalf(err, "create role [%s] failed", r.Name)
-       return
 }
diff --git a/server/service/rbac/role_dao.go b/server/service/rbac/role_dao.go
index 00c022d..1d8de00 100644
--- a/server/service/rbac/role_dao.go
+++ b/server/service/rbac/role_dao.go
@@ -20,15 +20,16 @@ package rbac
 import (
        "context"
        "errors"
+
+       "github.com/go-chassis/cari/discovery"
+       "github.com/go-chassis/cari/rbac"
+
        "github.com/apache/servicecomb-service-center/datasource"
        errorsEx "github.com/apache/servicecomb-service-center/pkg/errors"
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/util"
        "github.com/apache/servicecomb-service-center/server/plugin/quota"
        "github.com/apache/servicecomb-service-center/server/service/validator"
-       "github.com/go-chassis/cari/discovery"
-
-       "github.com/go-chassis/cari/rbac"
 )
 
 func CreateRole(ctx context.Context, r *rbac.Role) error {
diff --git a/server/service/rule.go b/server/service/rule.go
index f2c00c1..7b405e8 100644
--- a/server/service/rule.go
+++ b/server/service/rule.go
@@ -19,12 +19,13 @@ package service
 
 import (
        "context"
-       "github.com/apache/servicecomb-service-center/server/service/validator"
+
+       pb "github.com/go-chassis/cari/discovery"
 
        "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/util"
-       pb "github.com/go-chassis/cari/discovery"
+       "github.com/apache/servicecomb-service-center/server/service/validator"
 )
 
 func (s *MicroServiceService) AddRule(ctx context.Context, in 
*pb.AddServiceRulesRequest) (*pb.AddServiceRulesResponse, error) {
diff --git a/server/service/tag.go b/server/service/tag.go
index 7767457..67d99d3 100644
--- a/server/service/tag.go
+++ b/server/service/tag.go
@@ -19,12 +19,13 @@ package service
 
 import (
        "context"
-       "github.com/apache/servicecomb-service-center/server/service/validator"
+
+       pb "github.com/go-chassis/cari/discovery"
 
        "github.com/apache/servicecomb-service-center/datasource"
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/util"
-       pb "github.com/go-chassis/cari/discovery"
+       "github.com/apache/servicecomb-service-center/server/service/validator"
 )
 
 func (s *MicroServiceService) AddTags(ctx context.Context, in 
*pb.AddServiceTagsRequest) (*pb.AddServiceTagsResponse, error) {
diff --git a/server/service/validator/validator.go 
b/server/service/validator/validator.go
index 04392b5..b00ea98 100644
--- a/server/service/validator/validator.go
+++ b/server/service/validator/validator.go
@@ -19,10 +19,12 @@ package validator
 
 import (
        "errors"
+       "reflect"
+
+       pb "github.com/go-chassis/cari/discovery"
+
        "github.com/apache/servicecomb-service-center/pkg/log"
        "github.com/apache/servicecomb-service-center/pkg/validate"
-       pb "github.com/go-chassis/cari/discovery"
-       "reflect"
 )
 
 var createAccountValidator = &validate.Validator{}

Reply via email to