From b7e348319f82444e18ecda284e20656d7ed3b861 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Jun 2022 13:07:38 +0800 Subject: [PATCH 1/8] build(deps): bump github.com/emicklei/go-restful/v3 from 3.7.4 to 3.8.0 (#1929) Bumps [github.com/emicklei/go-restful/v3](https://github.com/emicklei/go-restful) from 3.7.4 to 3.8.0. - [Release notes](https://github.com/emicklei/go-restful/releases) - [Changelog](https://github.com/emicklei/go-restful/blob/v3/CHANGES.md) - [Commits](https://github.com/emicklei/go-restful/compare/v3.7.4...v3.8.0) --- updated-dependencies: - dependency-name: github.com/emicklei/go-restful/v3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 7381081a4c..ad4b7ac83e 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/dubbogo/gost v1.11.25 github.com/dubbogo/grpc-go v1.42.9 github.com/dubbogo/triple v1.1.8 - github.com/emicklei/go-restful/v3 v3.7.4 + github.com/emicklei/go-restful/v3 v3.8.0 github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 github.com/fsnotify/fsnotify v1.5.4 github.com/go-co-op/gocron v1.9.0 diff --git a/go.sum b/go.sum index b8b2ab8b2f..aed240940f 100644 --- a/go.sum +++ b/go.sum @@ -190,8 +190,8 @@ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/emicklei/go-restful/v3 v3.7.4 h1:PVGUqKvvMzQYiO89TdXrH9EMks+okTaRIMQ3jgMdZ30= -github.com/emicklei/go-restful/v3 v3.7.4/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.8.0 h1:eCZ8ulSerjdAiaNpF7GxXIE7ZCMo1moN1qX+S609eVw= +github.com/emicklei/go-restful/v3 v3.8.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= From ffc8f2b43ba6ebebbe52a2e6cb52eed45c536029 Mon Sep 17 00:00:00 2001 From: Leospard <694963063@qq.com> Date: Fri, 1 Jul 2022 18:04:31 +0800 Subject: [PATCH 2/8] move common/file into common/constant --- common/constant/file/suffix.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 common/constant/file/suffix.go diff --git a/common/constant/file/suffix.go b/common/constant/file/suffix.go new file mode 100644 index 0000000000..bd8876c57e --- /dev/null +++ b/common/constant/file/suffix.go @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package file + +type Suffix string + +const ( + JSON = Suffix("json") + TOML = Suffix("toml") + YAML = Suffix("yaml") + YML = Suffix("yml") + PROPERTIES = Suffix("properties") +) From c0e50a00f015cbaab4a46f820c8915b5be177e9b Mon Sep 17 00:00:00 2001 From: Leospard <694963063@qq.com> Date: Fri, 1 Jul 2022 18:05:28 +0800 Subject: [PATCH 3/8] move proxy out of common directory --- proxy/proxy.go | 277 +++++++++++++++++++++++ proxy/proxy_factory.go | 32 +++ proxy/proxy_factory/default.go | 168 ++++++++++++++ proxy/proxy_factory/default_test.go | 60 +++++ proxy/proxy_factory/pass_through.go | 128 +++++++++++ proxy/proxy_factory/pass_through_test.go | 61 +++++ proxy/proxy_factory/utils.go | 57 +++++ proxy/proxy_test.go | 159 +++++++++++++ 8 files changed, 942 insertions(+) create mode 100644 proxy/proxy.go create mode 100644 proxy/proxy_factory.go create mode 100644 proxy/proxy_factory/default.go create mode 100644 proxy/proxy_factory/default_test.go create mode 100644 proxy/proxy_factory/pass_through.go create mode 100644 proxy/proxy_factory/pass_through_test.go create mode 100644 proxy/proxy_factory/utils.go create mode 100644 proxy/proxy_test.go diff --git a/proxy/proxy.go b/proxy/proxy.go new file mode 100644 index 0000000000..ce2ea7cdfb --- /dev/null +++ b/proxy/proxy.go @@ -0,0 +1,277 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package proxy + +import ( + "context" + "errors" + "reflect" + "sync" + + "github.com/apache/dubbo-go-hessian2/java_exception" + + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + + invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation" +) + +// nolint +type Proxy struct { + rpc common.RPCService + invoke protocol.Invoker + callback interface{} + attachments map[string]string + implement ImplementFunc + once sync.Once +} + +type ( + // ProxyOption a function to init Proxy with options + ProxyOption func(p *Proxy) + // ImplementFunc function for proxy impl of RPCService functions + ImplementFunc func(p *Proxy, v common.RPCService) +) + +var typError = reflect.Zero(reflect.TypeOf((*error)(nil)).Elem()).Type() + +// NewProxy create service proxy. +func NewProxy(invoke protocol.Invoker, callback interface{}, attachments map[string]string) *Proxy { + return NewProxyWithOptions(invoke, callback, attachments, + WithProxyImplementFunc(DefaultProxyImplementFunc)) +} + +// NewProxyWithOptions create service proxy with options. +func NewProxyWithOptions(invoke protocol.Invoker, callback interface{}, attachments map[string]string, opts ...ProxyOption) *Proxy { + p := &Proxy{ + invoke: invoke, + callback: callback, + attachments: attachments, + } + for _, opt := range opts { + opt(p) + } + return p +} + +// WithProxyImplementFunc an option function to setup proxy.ImplementFunc +func WithProxyImplementFunc(f ImplementFunc) ProxyOption { + return func(p *Proxy) { + p.implement = f + } +} + +// Implement +// proxy implement +// In consumer, RPCService like: +// type XxxProvider struct { +// Yyy func(ctx context.Context, args []interface{}, rsp *Zzz) error +// } +func (p *Proxy) Implement(v common.RPCService) { + p.once.Do(func() { + p.implement(p, v) + p.rpc = v + }) +} + +// Get gets rpc service instance. +func (p *Proxy) Get() common.RPCService { + return p.rpc +} + +// GetCallback gets callback. +func (p *Proxy) GetCallback() interface{} { + return p.callback +} + +// GetInvoker gets Invoker. +func (p *Proxy) GetInvoker() protocol.Invoker { + return p.invoke +} + +// DefaultProxyImplementFunc the default function for proxy impl +func DefaultProxyImplementFunc(p *Proxy, v common.RPCService) { + // check parameters, incoming interface must be a elem's pointer. + valueOf := reflect.ValueOf(v) + + valueOfElem := valueOf.Elem() + + makeDubboCallProxy := func(methodName string, outs []reflect.Type) func(in []reflect.Value) []reflect.Value { + return func(in []reflect.Value) []reflect.Value { + var ( + err error + inv *invocation_impl.RPCInvocation + inIArr []interface{} + inVArr []reflect.Value + reply reflect.Value + replyEmptyFlag bool + ) + if methodName == "Echo" { + methodName = "$echo" + } + + if len(outs) == 2 { // return (reply, error) + if outs[0].Kind() == reflect.Ptr { + reply = reflect.New(outs[0].Elem()) + } else { + reply = reflect.New(outs[0]) + } + } else { // only return error + replyEmptyFlag = true + } + + start := 0 + end := len(in) + invCtx := context.Background() + // retrieve the context from the first argument if existed + if end > 0 { + if in[0].Type().String() == "context.Context" { + if !in[0].IsNil() { + // the user declared context as method's parameter + invCtx = in[0].Interface().(context.Context) + } + start += 1 + } + } + + if end-start <= 0 { + inIArr = []interface{}{} + inVArr = []reflect.Value{} + } else if v, ok := in[start].Interface().([]interface{}); ok && end-start == 1 { + inIArr = v + inVArr = []reflect.Value{in[start]} + } else { + inIArr = make([]interface{}, end-start) + inVArr = make([]reflect.Value, end-start) + index := 0 + for i := start; i < end; i++ { + inIArr[index] = in[i].Interface() + inVArr[index] = in[i] + index++ + } + } + + inv = invocation_impl.NewRPCInvocationWithOptions(invocation_impl.WithMethodName(methodName), + invocation_impl.WithArguments(inIArr), + invocation_impl.WithCallBack(p.callback), invocation_impl.WithParameterValues(inVArr)) + if !replyEmptyFlag { + inv.SetReply(reply.Interface()) + } + + for k, value := range p.attachments { + inv.SetAttachment(k, value) + } + + // add user setAttachment. It is compatibility with previous versions. + atm := invCtx.Value(constant.AttachmentKey) + if m, ok := atm.(map[string]string); ok { + for k, value := range m { + inv.SetAttachment(k, value) + } + } else if m2, ok2 := atm.(map[string]interface{}); ok2 { + // it is support to transfer map[string]interface{}. It refers to dubbo-java 2.7. + for k, value := range m2 { + inv.SetAttachment(k, value) + } + } + + result := p.invoke.Invoke(invCtx, inv) + err = result.Error() + // cause is raw user level error + cause := perrors.Cause(err) + if err != nil { + // if some error happened, it should be log some info in the separate file. + if throwabler, ok := cause.(java_exception.Throwabler); ok { + logger.Warnf("[CallProxy] invoke service throw exception: %v , stackTraceElements: %v", cause.Error(), throwabler.GetStackTrace()) + } else { + // entire error is only for printing, do not return, because user would not want to deal with massive framework-level error message + logger.Warnf("[CallProxy] received rpc err: %v", err) + } + } else { + logger.Debugf("[CallProxy] received rpc result successfully: %s", result) + } + if len(outs) == 1 { + return []reflect.Value{reflect.ValueOf(&cause).Elem()} + } + if len(outs) == 2 && outs[0].Kind() != reflect.Ptr { + return []reflect.Value{reply.Elem(), reflect.ValueOf(&cause).Elem()} + } + return []reflect.Value{reply, reflect.ValueOf(&cause).Elem()} + } + } + + if err := refectAndMakeObjectFunc(valueOfElem, makeDubboCallProxy); err != nil { + logger.Errorf("The type or combination type of RPCService %T must be a pointer of a struct. error is %s", v, err) + return + } +} + +func refectAndMakeObjectFunc(valueOfElem reflect.Value, makeDubboCallProxy func(methodName string, outs []reflect.Type) func(in []reflect.Value) []reflect.Value) error { + typeOf := valueOfElem.Type() + // check incoming interface, incoming interface's elem must be a struct. + if typeOf.Kind() != reflect.Struct { + return errors.New("invalid type kind") + } + numField := valueOfElem.NumField() + for i := 0; i < numField; i++ { + t := typeOf.Field(i) + methodName := t.Tag.Get("dubbo") + if methodName == "" { + methodName = t.Name + } + f := valueOfElem.Field(i) + if f.Kind() == reflect.Func && f.IsValid() && f.CanSet() { + outNum := t.Type.NumOut() + + if outNum != 1 && outNum != 2 { + logger.Warnf("method %s of mtype %v has wrong number of in out parameters %d; needs exactly 1/2", + t.Name, t.Type.String(), outNum) + continue + } + + // The latest return type of the method must be error. + if returnType := t.Type.Out(outNum - 1); returnType != typError { + logger.Warnf("the latest return type %s of method %q is not error", returnType, t.Name) + continue + } + + funcOuts := make([]reflect.Type, outNum) + for i := 0; i < outNum; i++ { + funcOuts[i] = t.Type.Out(i) + } + + // do method proxy here: + f.Set(reflect.MakeFunc(f.Type(), makeDubboCallProxy(methodName, funcOuts))) + logger.Debugf("set method [%s]", methodName) + } else if f.IsValid() && f.CanSet() { + // for struct combination + valueOfSub := reflect.New(t.Type) + valueOfElemInterface := valueOfSub.Elem() + if valueOfElemInterface.Type().Kind() == reflect.Struct { + if err := refectAndMakeObjectFunc(valueOfElemInterface, makeDubboCallProxy); err != nil { + return err + } + f.Set(valueOfElemInterface) + } + } + } + return nil +} diff --git a/proxy/proxy_factory.go b/proxy/proxy_factory.go new file mode 100644 index 0000000000..ac987afe22 --- /dev/null +++ b/proxy/proxy_factory.go @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package proxy + +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/protocol" +) + +type ProxyFactory interface { + GetProxy(invoker protocol.Invoker, url *common.URL) *Proxy + GetAsyncProxy(invoker protocol.Invoker, callBack interface{}, url *common.URL) *Proxy + GetInvoker(url *common.URL) protocol.Invoker +} + +// Option will define a function of handling ProxyFactory +type Option func(ProxyFactory) diff --git a/proxy/proxy_factory/default.go b/proxy/proxy_factory/default.go new file mode 100644 index 0000000000..2c949846e4 --- /dev/null +++ b/proxy/proxy_factory/default.go @@ -0,0 +1,168 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package proxy_factory + +import ( + "context" + "reflect" + "strings" + + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/common/extension" + "dubbo.apache.org/dubbo-go/v3/protocol" + "dubbo.apache.org/dubbo-go/v3/proxy" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) + +func init() { + extension.SetProxyFactory("default", NewDefaultProxyFactory) +} + +// DefaultProxyFactory is the default proxy factory +type DefaultProxyFactory struct { // delegate ProxyFactory +} + +// you can rewrite DefaultProxyFactory in extension and delegate the default proxy factory like below + +//func WithDelegate(delegateProxyFactory ProxyFactory) Option { +// return func(proxy ProxyFactory) { +// proxy.(*DefaultProxyFactory).delegate = delegateProxyFactory +// } +//} + +// NewDefaultProxyFactory returns a proxy factory instance +func NewDefaultProxyFactory(_ ...proxy.Option) proxy.ProxyFactory { + return &DefaultProxyFactory{} +} + +// GetProxy gets a proxy +func (factory *DefaultProxyFactory) GetProxy(invoker protocol.Invoker, url *common.URL) *proxy.Proxy { + return factory.GetAsyncProxy(invoker, nil, url) +} + +// GetAsyncProxy gets a async proxy +func (factory *DefaultProxyFactory) GetAsyncProxy(invoker protocol.Invoker, callBack interface{}, url *common.URL) *proxy.Proxy { + // create proxy + attachments := map[string]string{} + attachments[constant.AsyncKey] = url.GetParam(constant.AsyncKey, "false") + attachments[constant.EnvironmentKey] = url.GetParam(constant.EnvironmentKey, "dev") + return proxy.NewProxy(invoker, callBack, attachments) +} + +// GetInvoker gets a invoker +func (factory *DefaultProxyFactory) GetInvoker(url *common.URL) protocol.Invoker { + return &ProxyInvoker{ + BaseInvoker: *protocol.NewBaseInvoker(url), + } +} + +// ProxyInvoker is a invoker struct +type ProxyInvoker struct { + protocol.BaseInvoker +} + +// Invoke is used to call service method by invocation +func (pi *ProxyInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result { + result := &protocol.RPCResult{} + result.SetAttachments(invocation.Attachments()) + + // get providerUrl. The origin url may be is registry URL. + url := getProviderURL(pi.GetURL()) + + methodName := invocation.MethodName() + proto := url.Protocol + path := strings.TrimPrefix(url.Path, "/") + args := invocation.Arguments() + + // get service + svc := common.ServiceMap.GetServiceByServiceKey(proto, url.ServiceKey()) + if svc == nil { + logger.Errorf("cannot find service [%s] in %s", path, proto) + result.SetError(perrors.Errorf("cannot find service [%s] in %s", path, proto)) + return result + } + + // get method + method := svc.Method()[methodName] + if method == nil { + logger.Errorf("cannot find method [%s] of service [%s] in %s", methodName, path, proto) + result.SetError(perrors.Errorf("cannot find method [%s] of service [%s] in %s", methodName, path, proto)) + return result + } + + in := []reflect.Value{svc.Rcvr()} + if method.CtxType() != nil { + ctx = context.WithValue(ctx, constant.AttachmentKey, invocation.Attachments()) + in = append(in, method.SuiteContext(ctx)) + } + + // prepare argv + if (len(method.ArgsType()) == 1 || len(method.ArgsType()) == 2 && method.ReplyType() == nil) && method.ArgsType()[0].String() == "[]interface {}" { + in = append(in, reflect.ValueOf(args)) + } else { + for i := 0; i < len(args); i++ { + t := reflect.ValueOf(args[i]) + if !t.IsValid() { + at := method.ArgsType()[i] + if at.Kind() == reflect.Ptr { + at = at.Elem() + } + t = reflect.New(at) + } + in = append(in, t) + } + } + + // prepare replyv + var replyv reflect.Value + var retErr interface{} + + returnValues, callErr := callLocalMethod(method.Method(), in) + + if callErr != nil { + logger.Errorf("Invoke function error: %+v, service: %#v", callErr, url) + result.SetError(callErr) + return result + } + + if len(returnValues) == 1 { + retErr = returnValues[0].Interface() + } else { + replyv = returnValues[0] + retErr = returnValues[1].Interface() + } + + if retErr != nil { + result.SetError(retErr.(error)) + return result + } + if replyv.IsValid() && (replyv.Kind() != reflect.Ptr || replyv.Kind() == reflect.Ptr && replyv.Elem().IsValid()) { + result.SetResult(replyv.Interface()) + } + + return result +} + +func getProviderURL(url *common.URL) *common.URL { + if url.SubURL == nil { + return url + } + return url.SubURL +} diff --git a/proxy/proxy_factory/default_test.go b/proxy/proxy_factory/default_test.go new file mode 100644 index 0000000000..05ef1c53de --- /dev/null +++ b/proxy/proxy_factory/default_test.go @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package proxy_factory + +import ( + "fmt" + "testing" +) + +import ( + "github.com/stretchr/testify/assert" +) + +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/protocol" +) + +func TestGetProxy(t *testing.T) { + proxyFactory := NewDefaultProxyFactory() + url := common.NewURLWithOptions() + proxy := proxyFactory.GetProxy(protocol.NewBaseInvoker(url), url) + assert.NotNil(t, proxy) +} + +type TestAsync struct{} + +func (u *TestAsync) CallBack(res common.CallbackResponse) { + fmt.Println("CallBack res:", res) +} + +func TestGetAsyncProxy(t *testing.T) { + proxyFactory := NewDefaultProxyFactory() + url := common.NewURLWithOptions() + async := &TestAsync{} + proxy := proxyFactory.GetAsyncProxy(protocol.NewBaseInvoker(url), async.CallBack, url) + assert.NotNil(t, proxy) +} + +func TestGetInvoker(t *testing.T) { + proxyFactory := NewDefaultProxyFactory() + url := common.NewURLWithOptions() + invoker := proxyFactory.GetInvoker(url) + assert.True(t, invoker.IsAvailable()) +} diff --git a/proxy/proxy_factory/pass_through.go b/proxy/proxy_factory/pass_through.go new file mode 100644 index 0000000000..5b5fa74f68 --- /dev/null +++ b/proxy/proxy_factory/pass_through.go @@ -0,0 +1,128 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package proxy_factory + +import ( + "context" + "reflect" + + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/common/extension" + "dubbo.apache.org/dubbo-go/v3/protocol" + "dubbo.apache.org/dubbo-go/v3/proxy" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) + +func init() { + extension.SetProxyFactory(constant.PassThroughProxyFactoryKey, NewPassThroughProxyFactory) +} + +// PassThroughProxyFactory is the factory of PassThroughProxyInvoker +type PassThroughProxyFactory struct { +} + +// NewPassThroughProxyFactory returns a proxy factory instance +func NewPassThroughProxyFactory(_ ...proxy.Option) proxy.ProxyFactory { + return &PassThroughProxyFactory{} +} + +// GetProxy gets a proxy +func (factory *PassThroughProxyFactory) GetProxy(invoker protocol.Invoker, url *common.URL) *proxy.Proxy { + return factory.GetAsyncProxy(invoker, nil, url) +} + +// GetAsyncProxy gets a async proxy +func (factory *PassThroughProxyFactory) GetAsyncProxy(invoker protocol.Invoker, callBack interface{}, url *common.URL) *proxy.Proxy { + //create proxy + attachments := map[string]string{} + attachments[constant.AsyncKey] = url.GetParam(constant.AsyncKey, "false") + return proxy.NewProxy(invoker, callBack, attachments) +} + +// GetInvoker gets a invoker +func (factory *PassThroughProxyFactory) GetInvoker(url *common.URL) protocol.Invoker { + return &PassThroughProxyInvoker{ + ProxyInvoker: &ProxyInvoker{ + BaseInvoker: *protocol.NewBaseInvoker(url), + }, + } +} + +// PassThroughProxyInvoker is a invoker struct, it calls service with specific method 'Serivce' and params: +// Service(method string, argsTypes []string, args [][]byte, attachment map[string]interface{}) +// PassThroughProxyInvoker pass through raw invocation data and method name to service, which will deal with them. +type PassThroughProxyInvoker struct { + *ProxyInvoker +} + +// Invoke is used to call service method by invocation +func (pi *PassThroughProxyInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result { + result := &protocol.RPCResult{} + result.SetAttachments(invocation.Attachments()) + url := getProviderURL(pi.GetURL()) + + arguments := invocation.Arguments() + srv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey()) + + var args [][]byte + if len(arguments) > 0 { + args = make([][]byte, 0, len(arguments)) + for _, arg := range arguments { + if v, ok := arg.([]byte); ok { + args = append(args, v) + } else { + result.Err = perrors.New("the param type is not []byte") + return result + } + } + } + method := srv.Method()["Service"] + + in := make([]reflect.Value, 5) + in = append(in, srv.Rcvr()) + in = append(in, reflect.ValueOf(invocation.MethodName())) + in = append(in, reflect.ValueOf(invocation.GetAttachmentInterface(constant.ParamsTypeKey))) + in = append(in, reflect.ValueOf(args)) + in = append(in, reflect.ValueOf(invocation.Attachments())) + + var replyv reflect.Value + var retErr interface{} + + returnValues, callErr := callLocalMethod(method.Method(), in) + + if callErr != nil { + logger.Errorf("Invoke function error: %+v, service: %#v", callErr, url) + result.SetError(callErr) + return result + } + + replyv = returnValues[0] + retErr = returnValues[1].Interface() + + if retErr != nil { + result.SetError(retErr.(error)) + return result + } + if replyv.IsValid() && (replyv.Kind() != reflect.Ptr || replyv.Kind() == reflect.Ptr && replyv.Elem().IsValid()) { + result.SetResult(replyv.Interface()) + } + + return result +} diff --git a/proxy/proxy_factory/pass_through_test.go b/proxy/proxy_factory/pass_through_test.go new file mode 100644 index 0000000000..1d004c9805 --- /dev/null +++ b/proxy/proxy_factory/pass_through_test.go @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package proxy_factory + +import ( + "fmt" + "testing" +) + +import ( + "github.com/stretchr/testify/assert" +) + +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/protocol" +) + +func TestPassThroughProxyFactoryGetProxy(t *testing.T) { + proxyFactory := NewPassThroughProxyFactory() + url := common.NewURLWithOptions() + proxy := proxyFactory.GetProxy(protocol.NewBaseInvoker(url), url) + assert.NotNil(t, proxy) +} + +type TestPassThroughProxyFactoryAsync struct { +} + +func (u *TestPassThroughProxyFactoryAsync) CallBack(res common.CallbackResponse) { + fmt.Println("CallBack res:", res) +} + +func TestPassThroughProxyFactoryGetAsyncProxy(t *testing.T) { + proxyFactory := NewPassThroughProxyFactory() + url := common.NewURLWithOptions() + async := &TestPassThroughProxyFactoryAsync{} + proxy := proxyFactory.GetAsyncProxy(protocol.NewBaseInvoker(url), async.CallBack, url) + assert.NotNil(t, proxy) +} + +func TestPassThroughProxyFactoryGetInvoker(t *testing.T) { + proxyFactory := NewPassThroughProxyFactory() + url := common.NewURLWithOptions() + invoker := proxyFactory.GetInvoker(url) + assert.True(t, invoker.IsAvailable()) +} diff --git a/proxy/proxy_factory/utils.go b/proxy/proxy_factory/utils.go new file mode 100644 index 0000000000..44af7d28c0 --- /dev/null +++ b/proxy/proxy_factory/utils.go @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package proxy_factory + +import ( + "fmt" + "reflect" +) + +import ( + perrors "github.com/pkg/errors" +) + +// CallLocalMethod is used to handle invoke exception in user func. +func callLocalMethod(method reflect.Method, in []reflect.Value) ([]reflect.Value, error) { + var ( + returnValues []reflect.Value + retErr error + ) + + func() { + defer func() { + if e := recover(); e != nil { + if err, ok := e.(error); ok { + retErr = err + } else if err, ok := e.(string); ok { + retErr = perrors.New(err) + } else { + retErr = fmt.Errorf("invoke function error, unknow exception: %+v", e) + } + } + }() + + returnValues = method.Func.Call(in) + }() + + if retErr != nil { + return nil, retErr + } + + return returnValues, retErr +} diff --git a/proxy/proxy_test.go b/proxy/proxy_test.go new file mode 100644 index 0000000000..835e42121f --- /dev/null +++ b/proxy/proxy_test.go @@ -0,0 +1,159 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package proxy + +import ( + "context" + "fmt" + "reflect" + "testing" +) + +import ( + perrors "github.com/pkg/errors" + + "github.com/stretchr/testify/assert" +) + +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/protocol" + "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/hessian2" + "dubbo.apache.org/dubbo-go/v3/protocol/invocation" +) + +type TestService struct { + MethodOne func(context.Context, int, bool, *interface{}) error + MethodTwo func([]interface{}) error + MethodThree func(int, bool) (interface{}, error) + MethodFour func(int, bool) (*interface{}, error) `dubbo:"methodFour"` + MethodFive func() error + MethodSix func(context.Context, string) (interface{}, error) + Echo func(interface{}, *interface{}) error +} + +func (s *TestService) Reference() string { + return "com.test.Path" +} + +type TestServiceInt int + +func (s *TestServiceInt) Reference() string { + return "com.test.TestServiceInt" +} + +func TestProxyImplement(t *testing.T) { + invoker := protocol.NewBaseInvoker(&common.URL{}) + p := NewProxy(invoker, nil, map[string]string{constant.AsyncKey: "false"}) + s := &TestService{} + p.Implement(s) + + err := p.Get().(*TestService).MethodOne(nil, 0, false, nil) + assert.NoError(t, err) + + err = p.Get().(*TestService).MethodTwo(nil) + assert.NoError(t, err) + ret, err := p.Get().(*TestService).MethodThree(0, false) + assert.NoError(t, err) + assert.Nil(t, ret) // ret is nil, because it doesn't be injection yet + + ret2, err := p.Get().(*TestService).MethodFour(0, false) + assert.NoError(t, err) + assert.Equal(t, "*interface {}", reflect.TypeOf(ret2).String()) + err = p.Get().(*TestService).Echo(nil, nil) + assert.NoError(t, err) + + err = p.Get().(*TestService).MethodFive() + assert.NoError(t, err) + + // inherit & lowercase + p.rpc = nil + type S1 struct { + TestService + methodOne func(context.Context, interface{}, *struct{}) error + } + s1 := &S1{TestService: *s, methodOne: func(_ context.Context, _ interface{}, _ *struct{}) error { + return perrors.New("errors") + }} + p.Implement(s1) + err = s1.MethodOne(nil, 0, false, nil) + assert.NoError(t, err) + err = s1.methodOne(nil, nil, nil) + assert.EqualError(t, err, "errors") + + // no struct + p.rpc = nil + it := TestServiceInt(1) + p.Implement(&it) + assert.Nil(t, p.rpc) + + // return number + p.rpc = nil + type S2 struct { + TestService + MethodOne func([]interface{}) (*struct{}, int, error) + } + s2 := &S2{TestService: *s} + p.Implement(s2) + assert.Nil(t, s2.MethodOne) + + // returns type + p.rpc = nil + type S3 struct { + TestService + MethodOne func(context.Context, []interface{}, *struct{}) interface{} + } + s3 := &S3{TestService: *s} + p.Implement(s3) + assert.Nil(t, s3.MethodOne) +} + +func TestProxyImplementForContext(t *testing.T) { + invoker := &TestProxyInvoker{ + BaseInvoker: *protocol.NewBaseInvoker(&common.URL{}), + } + p := NewProxy(invoker, nil, map[string]string{constant.AsyncKey: "false"}) + s := &TestService{} + p.Implement(s) + attachments1 := make(map[string]interface{}, 4) + attachments1["k1"] = "v1" + attachments1["k2"] = "v2" + context := context.WithValue(context.Background(), constant.AttachmentKey, attachments1) + r, err := p.Get().(*TestService).MethodSix(context, "xxx") + v1 := r.(map[string]interface{}) + assert.NoError(t, err) + assert.Equal(t, v1["TestProxyInvoker"], "TestProxyInvokerValue") +} + +type TestProxyInvoker struct { + protocol.BaseInvoker +} + +func (bi *TestProxyInvoker) Invoke(_ context.Context, inv protocol.Invocation) protocol.Result { + rpcInv := inv.(*invocation.RPCInvocation) + mapV := inv.Attachments() + mapV["TestProxyInvoker"] = "TestProxyInvokerValue" + if err := hessian2.ReflectResponse(mapV, rpcInv.Reply()); err != nil { + fmt.Printf("hessian2.ReflectResponse(mapV:%v) = error:%v", mapV, err) + } + + return &protocol.RPCResult{ + Rest: inv.Arguments(), + } +} From 80380b0aa9252da704ca75b98aeacec90ac6e74c Mon Sep 17 00:00:00 2001 From: Leospard <694963063@qq.com> Date: Fri, 1 Jul 2022 18:20:10 +0800 Subject: [PATCH 4/8] modify import path --- .../cluster/adaptivesvc/cluster_invoker.go | 10 ++----- cluster/cluster/base/cluster_invoker.go | 7 ++--- cluster/cluster/broadcast/cluster_invoker.go | 4 +-- cluster/cluster/failback/cluster_invoker.go | 9 ++---- cluster/cluster/failover/cluster_invoker.go | 9 ++---- cluster/cluster/failsafe/cluster_invoker.go | 4 +-- cluster/cluster/forking/cluster_invoker.go | 9 ++---- cluster/cluster/mock.go | 9 ++---- cluster/loadbalance/p2c/loadbalance.go | 4 +-- cluster/loadbalance/ringhash/ringhash.go | 4 +-- cluster/router/chain/chain.go | 12 ++------ cluster/router/meshrouter/meshrouter.go | 4 +-- cluster/router/tag/match.go | 4 +-- cluster/router/tag/router.go | 8 ++--- common/extension/proxy_factory.go | 4 +-- common/proxy/proxy.go | 10 ++----- common/proxy/proxy_factory/default.go | 11 ++----- common/proxy/proxy_factory/pass_through.go | 11 ++----- common/rpc_service.go | 7 +---- config/config_center_config.go | 10 ++----- config/config_loader_options.go | 12 ++------ config/config_loader_options_test.go | 7 +---- config/config_resolver.go | 7 ++--- config/consumer_config.go | 9 ++---- config/graceful_shutdown.go | 9 ++---- config/graceful_shutdown_config.go | 10 ++----- config/logger_config.go | 13 ++------ config/logger_config_test.go | 7 +---- config/metadata_report_config.go | 7 ++--- config/provider_config.go | 10 ++----- config/reference_config.go | 9 ++---- config/reference_config_test.go | 8 ++--- config/registry_config.go | 9 ++---- config/root_config.go | 13 ++------ config/root_config_test.go | 9 ++---- config/service_config.go | 12 ++------ config/service_config_test.go | 10 ++----- config_center/apollo/impl.go | 11 ++----- config_center/apollo/listener.go | 7 ++--- config_center/file/listener.go | 9 ++---- config_center/nacos/client.go | 9 ++---- config_center/nacos/facade.go | 9 ++---- config_center/nacos/impl.go | 10 ++----- config_center/nacos/listener.go | 11 ++----- config_center/parser/configuration_parser.go | 12 ++------ config_center/zookeeper/impl.go | 10 ++----- filter/accesslog/filter.go | 4 +-- filter/active/filter.go | 5 ++-- filter/adaptivesvc/filter.go | 9 ++---- filter/adaptivesvc/limiter/utils.go | 4 +-- filter/auth/provider_auth_filter.go | 4 +-- filter/auth/sign_util.go | 4 +-- filter/exec_limit/filter.go | 10 ++----- filter/generic/filter.go | 10 ++----- filter/generic/generalizer/gson.go | 9 ++---- filter/generic/generalizer/map.go | 10 ++----- filter/generic/service_filter.go | 10 ++----- filter/generic/util.go | 4 +-- filter/graceful_shutdown/consumer_filter.go | 4 +-- filter/graceful_shutdown/provider_filter.go | 4 +-- .../rejected_execution_handler_only_log.go | 4 +-- filter/hystrix/filter.go | 12 ++------ filter/seata/filter.go | 4 +-- filter/sentinel/filter.go | 13 +++----- filter/tps/filter.go | 6 ++-- filter/tps/limiter/method_service.go | 9 ++---- filter/xds/cb/filter.go | 4 +-- go.mod | 2 +- go.sum | 30 ++++++++++++++----- imports/imports.go | 2 +- .../mapping/metadata/service_name_mapping.go | 9 ++---- metadata/report/delegate/delegate_report.go | 12 ++------ .../report/delegate/delegate_report_test.go | 12 ++------ metadata/report/etcd/report.go | 10 ++----- metadata/report/nacos/report.go | 11 ++----- metadata/report/zookeeper/report.go | 8 ++--- .../service/exporter/configurable/exporter.go | 7 +++-- .../exporter/configurable/exporter_test.go | 11 ++++--- .../local/metadata_service_proxy_factory.go | 4 +-- metadata/service/local/service.go | 9 ++---- metadata/service/local/service_proxy.go | 4 +-- metadata/service/remote/service.go | 9 ++---- metadata/service/remote/service_test.go | 12 ++------ metrics/prometheus/reporter.go | 9 ++---- protocol/dubbo/dubbo_codec.go | 10 ++----- protocol/dubbo/dubbo_exporter.go | 4 +-- protocol/dubbo/dubbo_invoker.go | 10 ++----- protocol/dubbo/dubbo_invoker_test.go | 2 +- protocol/dubbo/dubbo_protocol.go | 9 ++---- protocol/dubbo/dubbo_protocol_test.go | 9 ++---- protocol/dubbo/hessian2/hessian_request.go | 7 +---- protocol/dubbo/hessian2/hessian_response.go | 7 +---- protocol/dubbo/impl/codec.go | 9 ++---- protocol/dubbo/impl/hessian.go | 9 ++---- protocol/dubbo3/dubbo3_exporter.go | 9 ++---- protocol/dubbo3/dubbo3_invoker.go | 11 +++---- protocol/dubbo3/dubbo3_protocol.go | 10 ++----- protocol/dubbo3/internal/server.go | 9 +++--- protocol/grpc/client.go | 16 +++------- protocol/grpc/grpc_exporter.go | 4 +-- protocol/grpc/grpc_invoker.go | 13 ++------ protocol/grpc/grpc_protocol.go | 4 +-- protocol/grpc/internal/helloworld/server.go | 6 +--- protocol/grpc/internal/routeguide/client.go | 4 +-- protocol/grpc/internal/routeguide/server.go | 7 +---- protocol/grpc/server.go | 15 +++------- protocol/invoker.go | 9 ++---- protocol/jsonrpc/http.go | 9 ++---- protocol/jsonrpc/http_test.go | 4 +-- protocol/jsonrpc/jsonrpc_exporter.go | 4 +-- protocol/jsonrpc/jsonrpc_invoker.go | 5 ++-- protocol/jsonrpc/jsonrpc_invoker_test.go | 2 +- protocol/jsonrpc/jsonrpc_protocol.go | 4 +-- protocol/jsonrpc/server.go | 9 ++---- protocol/protocol.go | 4 +-- .../protocol_filter_wrapper.go | 4 +-- .../protocol_filter_wrapper_test.go | 9 ++---- .../rest/config/reader/rest_config_reader.go | 12 ++------ .../config/reader/rest_config_reader_test.go | 9 ++---- protocol/rest/rest_exporter.go | 4 +-- protocol/rest/rest_protocol.go | 8 +++-- protocol/rest/rest_protocol_test.go | 2 +- protocol/rest/server/rest_server.go | 10 ++----- .../server/server_impl/go_restful_server.go | 9 ++---- protocol/rpc_status.go | 9 ++---- registry/base_configuration_listener.go | 7 ++--- registry/base_registry.go | 9 ++---- registry/directory/directory.go | 10 ++----- registry/etcdv3/listener.go | 9 ++---- registry/etcdv3/registry.go | 9 ++---- registry/etcdv3/service_discovery.go | 12 +++----- registry/event.go | 4 +-- registry/event/base_configuration_listener.go | 7 ++--- .../metadata_service_url_params_customizer.go | 9 ++---- .../protocol_ports_metadata_customizer.go | 4 +-- ...service_instances_changed_listener_impl.go | 11 ++----- registry/event/service_revision_customizer.go | 4 +-- registry/mock_registry.go | 9 ++---- registry/nacos/listener.go | 11 ++----- registry/nacos/registry.go | 10 ++----- registry/nacos/service_discovery.go | 13 +++----- registry/polaris/listener.go | 12 ++------ registry/polaris/registry.go | 14 +++------ registry/polaris/service_discovery.go | 15 ++++------ registry/protocol/protocol.go | 11 +++---- registry/service_instance.go | 9 ++---- .../service_instances_changed_listener.go | 7 +---- .../service_discovery_registry.go | 12 ++------ registry/xds/registry.go | 10 ++----- registry/zookeeper/listener.go | 9 ++---- registry/zookeeper/registry.go | 9 ++---- registry/zookeeper/service_discovery.go | 9 ++---- registry/zookeeper/service_discovery_test.go | 2 +- remoting/etcdv3/client.go | 5 +--- remoting/etcdv3/facade.go | 9 ++---- remoting/etcdv3/listener.go | 10 ++----- remoting/exchange.go | 9 ++---- remoting/exchange_client.go | 9 ++---- remoting/getty/getty_client.go | 18 ++++------- remoting/getty/getty_client_test.go | 9 ++---- remoting/getty/getty_server.go | 14 +++------ remoting/getty/listener.go | 11 ++----- remoting/getty/pool.go | 11 ++----- remoting/getty/readwriter.go | 11 ++----- remoting/getty/readwriter_test.go | 12 ++------ remoting/nacos/builder.go | 9 ++---- remoting/xds/client.go | 10 ++----- remoting/xds/ewatcher/ewatcher.go | 5 ++-- remoting/xds/mapping/handler.go | 9 ++---- remoting/zookeeper/client.go | 9 ++---- .../curator_discovery/service_discovery.go | 9 ++---- remoting/zookeeper/facade.go | 9 ++---- remoting/zookeeper/listener.go | 9 ++---- xds/balancer/cdsbalancer/cdsbalancer.go | 12 ++------ xds/balancer/clusterimpl/clusterimpl.go | 10 ++----- xds/balancer/clusterimpl/picker.go | 4 +-- .../clustermanager/balancerstateaggregator.go | 7 +---- xds/balancer/clustermanager/clustermanager.go | 8 +---- .../clusterresolver/clusterresolver.go | 10 +------ xds/balancer/clusterresolver/configbuilder.go | 8 ++--- xds/balancer/orca/orca.go | 7 ++--- xds/balancer/priority/balancer.go | 8 +---- xds/balancer/ringhash/picker.go | 9 +----- xds/balancer/ringhash/ringhash.go | 9 +----- xds/client/authority.go | 6 +--- xds/client/bootstrap/bootstrap.go | 10 ++----- xds/client/client.go | 7 ++--- xds/client/controller.go | 4 +-- xds/client/controller/controller.go | 7 +---- xds/client/controller/version/v2/client.go | 13 ++++---- xds/client/controller/version/v3/client.go | 13 ++++---- xds/client/controller/version/version.go | 9 ++---- xds/client/pubsub/pubsub.go | 4 +-- xds/client/resource/filter_chain.go | 8 ++--- xds/client/resource/unmarshal.go | 6 +--- xds/client/resource/unmarshal_cds.go | 10 ++----- xds/client/resource/unmarshal_eds.go | 9 ++---- xds/client/resource/unmarshal_lds.go | 10 ++----- xds/client/resource/unmarshal_rds.go | 9 +----- xds/csds/csds.go | 23 +++++++------- xds/resolver/watch_service.go | 4 +-- xds/resolver/xds_resolver.go | 8 ++--- xds/server/listener_wrapper.go | 9 ++---- xds/utils/balancergroup/balancergroup.go | 9 ++---- xds/utils/grpclog/grpclog.go | 4 +-- xds/utils/serviceconfig/serviceconfig.go | 8 +---- 206 files changed, 470 insertions(+), 1279 deletions(-) diff --git a/cluster/cluster/adaptivesvc/cluster_invoker.go b/cluster/cluster/adaptivesvc/cluster_invoker.go index 64fa272bbc..b7fdb2f631 100644 --- a/cluster/cluster/adaptivesvc/cluster_invoker.go +++ b/cluster/cluster/adaptivesvc/cluster_invoker.go @@ -20,21 +20,17 @@ package adaptivesvc import ( "context" "strconv" -) - -import ( - perrors "github.com/pkg/errors" -) -import ( "dubbo.apache.org/dubbo-go/v3/cluster/cluster/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/cluster/metrics" + perrors "github.com/pkg/errors" + clsutils "dubbo.apache.org/dubbo-go/v3/cluster/utils" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) var _ protocol.Invoker = (*adaptiveServiceClusterInvoker)(nil) diff --git a/cluster/cluster/base/cluster_invoker.go b/cluster/cluster/base/cluster_invoker.go index facb1e6e2d..cfc0c38158 100644 --- a/cluster/cluster/base/cluster_invoker.go +++ b/cluster/cluster/base/cluster_invoker.go @@ -21,17 +21,14 @@ package base import ( perrors "github.com/pkg/errors" - "go.uber.org/atomic" -) - -import ( "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + "go.uber.org/atomic" ) type BaseClusterInvoker struct { diff --git a/cluster/cluster/broadcast/cluster_invoker.go b/cluster/cluster/broadcast/cluster_invoker.go index a0ee7c7230..12c13eef0a 100644 --- a/cluster/cluster/broadcast/cluster_invoker.go +++ b/cluster/cluster/broadcast/cluster_invoker.go @@ -19,13 +19,11 @@ package broadcast import ( "context" -) -import ( "dubbo.apache.org/dubbo-go/v3/cluster/cluster/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) type broadcastClusterInvoker struct { diff --git a/cluster/cluster/failback/cluster_invoker.go b/cluster/cluster/failback/cluster_invoker.go index 71b260f3e1..48cad4cc89 100644 --- a/cluster/cluster/failback/cluster_invoker.go +++ b/cluster/cluster/failback/cluster_invoker.go @@ -22,20 +22,15 @@ import ( "strconv" "sync" "time" -) -import ( - "github.com/Workiva/go-datastructures/queue" -) - -import ( "dubbo.apache.org/dubbo-go/v3/cluster/cluster/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/Workiva/go-datastructures/queue" + "github.com/dubbogo/gost/log/logger" ) /** diff --git a/cluster/cluster/failover/cluster_invoker.go b/cluster/cluster/failover/cluster_invoker.go index d217fa4c90..5ceaeceada 100644 --- a/cluster/cluster/failover/cluster_invoker.go +++ b/cluster/cluster/failover/cluster_invoker.go @@ -21,19 +21,14 @@ import ( "context" "fmt" "strconv" -) -import ( - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/cluster/cluster/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) type failoverClusterInvoker struct { diff --git a/cluster/cluster/failsafe/cluster_invoker.go b/cluster/cluster/failsafe/cluster_invoker.go index 660822e7e9..01d2c59e8e 100644 --- a/cluster/cluster/failsafe/cluster_invoker.go +++ b/cluster/cluster/failsafe/cluster_invoker.go @@ -19,15 +19,13 @@ package failsafe import ( "context" -) -import ( "dubbo.apache.org/dubbo-go/v3/cluster/cluster/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) /** diff --git a/cluster/cluster/forking/cluster_invoker.go b/cluster/cluster/forking/cluster_invoker.go index ad2dc4d25f..4cf4a5a510 100644 --- a/cluster/cluster/forking/cluster_invoker.go +++ b/cluster/cluster/forking/cluster_invoker.go @@ -21,18 +21,13 @@ import ( "context" "fmt" "time" -) -import ( - "github.com/Workiva/go-datastructures/queue" -) - -import ( "dubbo.apache.org/dubbo-go/v3/cluster/cluster/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/Workiva/go-datastructures/queue" + "github.com/dubbogo/gost/log/logger" ) type forkingClusterInvoker struct { diff --git a/cluster/cluster/mock.go b/cluster/cluster/mock.go index 77d3829d52..ad01179c53 100644 --- a/cluster/cluster/mock.go +++ b/cluster/cluster/mock.go @@ -19,17 +19,12 @@ package cluster import ( "context" -) -import ( - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) var Count int diff --git a/cluster/loadbalance/p2c/loadbalance.go b/cluster/loadbalance/p2c/loadbalance.go index 3e40fa4861..ec12eab82a 100644 --- a/cluster/loadbalance/p2c/loadbalance.go +++ b/cluster/loadbalance/p2c/loadbalance.go @@ -23,15 +23,13 @@ import ( "math/rand" "sync" "time" -) -import ( "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" "dubbo.apache.org/dubbo-go/v3/cluster/metrics" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) var ( diff --git a/cluster/loadbalance/ringhash/ringhash.go b/cluster/loadbalance/ringhash/ringhash.go index 3bd5f085f9..5e3a34fc18 100644 --- a/cluster/loadbalance/ringhash/ringhash.go +++ b/cluster/loadbalance/ringhash/ringhash.go @@ -19,16 +19,14 @@ package ringhash import ( "strconv" -) -import ( "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/remoting/xds" + "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/cluster/router/chain/chain.go b/cluster/router/chain/chain.go index 3ed67a919f..5847a455dc 100644 --- a/cluster/router/chain/chain.go +++ b/cluster/router/chain/chain.go @@ -20,20 +20,14 @@ package chain import ( "sort" "sync" -) - -import ( - perrors "github.com/pkg/errors" - - "go.uber.org/atomic" -) -import ( "dubbo.apache.org/dubbo-go/v3/cluster/router" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "go.uber.org/atomic" ) // RouterChain Router chain diff --git a/cluster/router/meshrouter/meshrouter.go b/cluster/router/meshrouter/meshrouter.go index 567f58a14b..07566c7d0b 100644 --- a/cluster/router/meshrouter/meshrouter.go +++ b/cluster/router/meshrouter/meshrouter.go @@ -19,16 +19,14 @@ package meshrouter import ( "math/rand" -) -import ( "dubbo.apache.org/dubbo-go/v3/cluster/router" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/remoting/xds" + "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/cluster/router/tag/match.go b/cluster/router/tag/match.go index 07e686b57b..dde7fb41c8 100644 --- a/cluster/router/tag/match.go +++ b/cluster/router/tag/match.go @@ -19,14 +19,12 @@ package tag import ( "strconv" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) type predicate func(invoker protocol.Invoker, tag interface{}) bool diff --git a/cluster/router/tag/router.go b/cluster/router/tag/router.go index 207443646f..5bbd1f78ff 100644 --- a/cluster/router/tag/router.go +++ b/cluster/router/tag/router.go @@ -20,21 +20,17 @@ package tag import ( "strings" "sync" -) -import ( + "dubbo.apache.org/dubbo-go/v3/common" "gopkg.in/yaml.v2" -) -import ( - "dubbo.apache.org/dubbo-go/v3/common" conf "dubbo.apache.org/dubbo-go/v3/common/config" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" ) type PriorityRouter struct { diff --git a/common/extension/proxy_factory.go b/common/extension/proxy_factory.go index f9e6246620..e9e3e5a6d3 100644 --- a/common/extension/proxy_factory.go +++ b/common/extension/proxy_factory.go @@ -18,8 +18,8 @@ package extension import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" - "dubbo.apache.org/dubbo-go/v3/common/proxy" + "dubbo.apache.org/dubbo-go/v3/proxy" + "github.com/dubbogo/gost/log/logger" ) var proxyFactories = make(map[string]func(...proxy.Option) proxy.ProxyFactory) diff --git a/common/proxy/proxy.go b/common/proxy/proxy.go index 016d293a56..ce2ea7cdfb 100644 --- a/common/proxy/proxy.go +++ b/common/proxy/proxy.go @@ -22,19 +22,15 @@ import ( "errors" "reflect" "sync" -) -import ( "github.com/apache/dubbo-go-hessian2/java_exception" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation" ) diff --git a/common/proxy/proxy_factory/default.go b/common/proxy/proxy_factory/default.go index 926dc17786..2c949846e4 100644 --- a/common/proxy/proxy_factory/default.go +++ b/common/proxy/proxy_factory/default.go @@ -21,19 +21,14 @@ import ( "context" "reflect" "strings" -) -import ( - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" - "dubbo.apache.org/dubbo-go/v3/common/proxy" "dubbo.apache.org/dubbo-go/v3/protocol" + "dubbo.apache.org/dubbo-go/v3/proxy" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) func init() { diff --git a/common/proxy/proxy_factory/pass_through.go b/common/proxy/proxy_factory/pass_through.go index 38cb2581b6..5b5fa74f68 100644 --- a/common/proxy/proxy_factory/pass_through.go +++ b/common/proxy/proxy_factory/pass_through.go @@ -20,19 +20,14 @@ package proxy_factory import ( "context" "reflect" -) -import ( - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" - "dubbo.apache.org/dubbo-go/v3/common/proxy" "dubbo.apache.org/dubbo-go/v3/protocol" + "dubbo.apache.org/dubbo-go/v3/proxy" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) func init() { diff --git a/common/rpc_service.go b/common/rpc_service.go index 45c7df91b7..4109e0ff55 100644 --- a/common/rpc_service.go +++ b/common/rpc_service.go @@ -24,16 +24,11 @@ import ( "sync" "unicode" "unicode/utf8" -) -import ( + "github.com/dubbogo/gost/log/logger" perrors "github.com/pkg/errors" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" -) - // RPCService the type alias of interface{} type RPCService = interface{} diff --git a/config/config_center_config.go b/config/config_center_config.go index 48baa80268..9af3b62955 100644 --- a/config/config_center_config.go +++ b/config/config_center_config.go @@ -20,23 +20,17 @@ package config import ( "net/url" "strings" -) -import ( + "dubbo.apache.org/dubbo-go/v3/common" "github.com/creasty/defaults" - "github.com/knadh/koanf" - "github.com/pkg/errors" -) -import ( - "dubbo.apache.org/dubbo-go/v3/common" conf "dubbo.apache.org/dubbo-go/v3/common/config" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" + "github.com/dubbogo/gost/log/logger" ) // CenterConfig is configuration for config center diff --git a/config/config_loader_options.go b/config/config_loader_options.go index 0f86300b7f..80a3fe5c5c 100644 --- a/config/config_loader_options.go +++ b/config/config_loader_options.go @@ -23,20 +23,14 @@ import ( "path/filepath" "runtime" "strings" -) -import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/common/constant/file" + "github.com/dubbogo/gost/log/logger" "github.com/knadh/koanf" - "github.com/pkg/errors" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/file" - "dubbo.apache.org/dubbo-go/v3/common/logger" -) - type loaderConf struct { suffix string // loaderConf file extension default yaml path string // loaderConf file path default ./conf/dubbogo.yaml diff --git a/config/config_loader_options_test.go b/config/config_loader_options_test.go index 2ace22b8b6..a066da7f71 100644 --- a/config/config_loader_options_test.go +++ b/config/config_loader_options_test.go @@ -20,16 +20,11 @@ package config import ( "strings" "testing" -) -import ( + "dubbo.apache.org/dubbo-go/v3/common/constant/file" "github.com/stretchr/testify/assert" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common/file" -) - func TestCheckGenre(t *testing.T) { err := checkFileSuffix("abc") diff --git a/config/config_resolver.go b/config/config_resolver.go index f94fce2c2f..b7b672219c 100644 --- a/config/config_resolver.go +++ b/config/config_resolver.go @@ -24,12 +24,9 @@ import ( "github.com/knadh/koanf/parsers/yaml" "github.com/knadh/koanf/providers/rawbytes" - "github.com/pkg/errors" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/file" + "dubbo.apache.org/dubbo-go/v3/common/constant/file" "dubbo.apache.org/dubbo-go/v3/config/parsers/properties" + "github.com/pkg/errors" ) // GetConfigResolver get config resolver diff --git a/config/consumer_config.go b/config/consumer_config.go index af04775d72..1ecc38d318 100644 --- a/config/consumer_config.go +++ b/config/consumer_config.go @@ -20,18 +20,13 @@ package config import ( "fmt" "time" -) -import ( "github.com/creasty/defaults" - tripleConstant "github.com/dubbogo/triple/pkg/common/constant" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" + tripleConstant "github.com/dubbogo/triple/pkg/common/constant" ) const ( diff --git a/config/graceful_shutdown.go b/config/graceful_shutdown.go index 01ebbbc8e7..93c6de890f 100644 --- a/config/graceful_shutdown.go +++ b/config/graceful_shutdown.go @@ -22,16 +22,11 @@ import ( "os/signal" "runtime/debug" "time" -) -import ( - gxset "github.com/dubbogo/gost/container/set" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" + gxset "github.com/dubbogo/gost/container/set" + "github.com/dubbogo/gost/log/logger" ) /* diff --git a/config/graceful_shutdown_config.go b/config/graceful_shutdown_config.go index 445796e2e3..b5d7753dfd 100644 --- a/config/graceful_shutdown_config.go +++ b/config/graceful_shutdown_config.go @@ -19,19 +19,13 @@ package config import ( "time" -) -import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" "github.com/creasty/defaults" - + "github.com/dubbogo/gost/log/logger" "go.uber.org/atomic" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" -) - const ( defaultTimeout = 60 * time.Second defaultStepTimeout = 3 * time.Second diff --git a/config/logger_config.go b/config/logger_config.go index 1050c0fb7a..9a8c7fc3c9 100644 --- a/config/logger_config.go +++ b/config/logger_config.go @@ -19,23 +19,16 @@ package config import ( "net/url" -) -import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" "github.com/creasty/defaults" - + "github.com/dubbogo/gost/encoding/yaml" + "github.com/dubbogo/gost/log/logger" "github.com/natefinch/lumberjack" - "go.uber.org/zap" "go.uber.org/zap/zapcore" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" - "dubbo.apache.org/dubbo-go/v3/common/yaml" -) - type ZapConfig struct { Level string `default:"info" json:"level,omitempty" yaml:"level" property:"level"` Development bool `default:"false" json:"development,omitempty" yaml:"development" property:"development"` diff --git a/config/logger_config_test.go b/config/logger_config_test.go index ed9ac24159..26ba56f5ff 100644 --- a/config/logger_config_test.go +++ b/config/logger_config_test.go @@ -19,16 +19,11 @@ package config import ( "testing" -) -import ( + "github.com/dubbogo/gost/log/logger" "github.com/stretchr/testify/assert" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" -) - func TestLoggerInit(t *testing.T) { t.Run("empty use default", func(t *testing.T) { err := Load(WithPath("./testdata/config/logger/empty_log.yaml")) diff --git a/config/metadata_report_config.go b/config/metadata_report_config.go index 99845ee24b..099c846127 100644 --- a/config/metadata_report_config.go +++ b/config/metadata_report_config.go @@ -17,16 +17,13 @@ package config -import ( - perrors "github.com/pkg/errors" -) - import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config/instance" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) // MetadataReportConfig is app level configuration diff --git a/config/provider_config.go b/config/provider_config.go index 0c024947c5..7ec9f4e106 100644 --- a/config/provider_config.go +++ b/config/provider_config.go @@ -19,20 +19,16 @@ package config import ( "fmt" -) -import ( "github.com/creasty/defaults" tripleConstant "github.com/dubbogo/triple/pkg/common/constant" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + aslimiter "dubbo.apache.org/dubbo-go/v3/filter/adaptivesvc/limiter" ) diff --git a/config/reference_config.go b/config/reference_config.go index f370691b06..142bccb4e0 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -22,23 +22,18 @@ import ( "net/url" "strconv" "time" -) -import ( "github.com/creasty/defaults" - gxstrings "github.com/dubbogo/gost/strings" -) - -import ( "dubbo.apache.org/dubbo-go/v3/cluster/directory/static" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/proxy" "dubbo.apache.org/dubbo-go/v3/config/generic" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper" + "dubbo.apache.org/dubbo-go/v3/proxy" + gxstrings "github.com/dubbogo/gost/strings" ) // ReferenceConfig is the configuration of service consumer diff --git a/config/reference_config_test.go b/config/reference_config_test.go index c8df59f884..3af9db1f64 100644 --- a/config/reference_config_test.go +++ b/config/reference_config_test.go @@ -19,15 +19,11 @@ package config import ( "testing" -) -import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" "github.com/stretchr/testify/assert" -) -import ( - "dubbo.apache.org/dubbo-go/v3/common/constant" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" + _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" ) //import ( diff --git a/config/registry_config.go b/config/registry_config.go index 5efba99623..d5ee614687 100644 --- a/config/registry_config.go +++ b/config/registry_config.go @@ -21,21 +21,16 @@ import ( "net/url" "strconv" "strings" -) -import ( "github.com/creasty/defaults" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config/instance" "dubbo.apache.org/dubbo-go/v3/registry" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) // RegistryConfig is the configuration of the registry center diff --git a/config/root_config.go b/config/root_config.go index 7f3d1aa995..1b4b3ed2b4 100644 --- a/config/root_config.go +++ b/config/root_config.go @@ -20,25 +20,18 @@ package config import ( _ "net/http/pprof" "sync" -) -import ( hessian "github.com/apache/dubbo-go-hessian2" - "github.com/knadh/koanf" - perrors "github.com/pkg/errors" - - "go.uber.org/atomic" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/metadata/service/exporter" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "go.uber.org/atomic" ) var ( diff --git a/config/root_config_test.go b/config/root_config_test.go index 887991c58e..00640f3f27 100644 --- a/config/root_config_test.go +++ b/config/root_config_test.go @@ -19,16 +19,11 @@ package config import ( "testing" -) -import ( - "github.com/stretchr/testify/assert" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/yaml" "dubbo.apache.org/dubbo-go/v3/config_center" + "github.com/dubbogo/gost/encoding/yaml" + "github.com/stretchr/testify/assert" ) func TestGoConfigProcess(t *testing.T) { diff --git a/config/service_config.go b/config/service_config.go index 1b41aa2721..69e6548588 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -26,25 +26,19 @@ import ( "strings" "sync" "time" -) -import ( "github.com/creasty/defaults" gxnet "github.com/dubbogo/gost/net" - perrors "github.com/pkg/errors" - - "go.uber.org/atomic" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "go.uber.org/atomic" ) // ServiceConfig is the configuration of the service provider diff --git a/config/service_config_test.go b/config/service_config_test.go index c3fa09d77c..c40fcc6250 100644 --- a/config/service_config_test.go +++ b/config/service_config_test.go @@ -21,16 +21,12 @@ import ( "context" "strings" "testing" -) - -import ( - "github.com/stretchr/testify/assert" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" + "github.com/stretchr/testify/assert" + + _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" ) type HelloService struct { diff --git a/config_center/apollo/impl.go b/config_center/apollo/impl.go index f6f64e47ea..07e8256ce6 100644 --- a/config_center/apollo/impl.go +++ b/config_center/apollo/impl.go @@ -22,21 +22,16 @@ import ( "regexp" "strings" "sync" -) -import ( gxset "github.com/dubbogo/gost/container/set" + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "github.com/dubbogo/gost/log/logger" perrors "github.com/pkg/errors" - "github.com/zouyx/agollo/v3" "github.com/zouyx/agollo/v3/env/config" -) -import ( - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" cc "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/config_center/parser" ) diff --git a/config_center/apollo/listener.go b/config_center/apollo/listener.go index 9080b73877..44f39f2d36 100644 --- a/config_center/apollo/listener.go +++ b/config_center/apollo/listener.go @@ -21,13 +21,10 @@ import ( "github.com/zouyx/agollo/v3" "github.com/zouyx/agollo/v3/storage" - "gopkg.in/yaml.v2" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + "gopkg.in/yaml.v2" ) type apolloListener struct { diff --git a/config_center/file/listener.go b/config_center/file/listener.go index 820768be20..c147953b60 100644 --- a/config_center/file/listener.go +++ b/config_center/file/listener.go @@ -20,17 +20,12 @@ package file import ( "io/ioutil" "sync" -) -import ( - "github.com/fsnotify/fsnotify" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + "github.com/fsnotify/fsnotify" ) // CacheListener is file watcher diff --git a/config_center/nacos/client.go b/config_center/nacos/client.go index 08ba373cb0..a153ebf3c4 100644 --- a/config_center/nacos/client.go +++ b/config_center/nacos/client.go @@ -20,17 +20,12 @@ package nacos import ( "sync" "time" -) -import ( nacosClient "github.com/dubbogo/gost/database/kv/nacos" - perrors "github.com/pkg/errors" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/remoting/nacos" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) // NacosClient Nacos configClient diff --git a/config_center/nacos/facade.go b/config_center/nacos/facade.go index 6141e1ea46..a50864dbee 100644 --- a/config_center/nacos/facade.go +++ b/config_center/nacos/facade.go @@ -19,15 +19,10 @@ package nacos import ( "sync" -) -import ( - nacosClient "github.com/dubbogo/gost/database/kv/nacos" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" + nacosClient "github.com/dubbogo/gost/database/kv/nacos" + "github.com/dubbogo/gost/log/logger" ) type nacosClientFacade interface { diff --git a/config_center/nacos/impl.go b/config_center/nacos/impl.go index f7e3f1f07b..580cc3538c 100644 --- a/config_center/nacos/impl.go +++ b/config_center/nacos/impl.go @@ -20,24 +20,20 @@ package nacos import ( "strings" "sync" -) -import ( gxset "github.com/dubbogo/gost/container/set" + nacosClient "github.com/dubbogo/gost/database/kv/nacos" constant2 "github.com/nacos-group/nacos-sdk-go/common/constant" "github.com/nacos-group/nacos-sdk-go/vo" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/config_center/parser" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) const ( diff --git a/config_center/nacos/listener.go b/config_center/nacos/listener.go index a4cf589e42..c3afb51d74 100644 --- a/config_center/nacos/listener.go +++ b/config_center/nacos/listener.go @@ -19,18 +19,13 @@ package nacos import ( "context" -) -import ( - constant2 "github.com/nacos-group/nacos-sdk-go/common/constant" - "github.com/nacos-group/nacos-sdk-go/vo" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + constant2 "github.com/nacos-group/nacos-sdk-go/common/constant" + "github.com/nacos-group/nacos-sdk-go/vo" ) func callback(listener config_center.ConfigurationListener, _, _, dataId, data string) { diff --git a/config_center/parser/configuration_parser.go b/config_center/parser/configuration_parser.go index 47c2410f52..4920a70067 100644 --- a/config_center/parser/configuration_parser.go +++ b/config_center/parser/configuration_parser.go @@ -20,20 +20,14 @@ package parser import ( "strconv" "strings" -) -import ( "github.com/magiconair/properties" - perrors "github.com/pkg/errors" - - "gopkg.in/yaml.v2" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "gopkg.in/yaml.v2" ) const ( diff --git a/config_center/zookeeper/impl.go b/config_center/zookeeper/impl.go index 730b882177..a81ec06bf9 100644 --- a/config_center/zookeeper/impl.go +++ b/config_center/zookeeper/impl.go @@ -22,25 +22,21 @@ import ( "strconv" "strings" "sync" -) -import ( "github.com/dubbogo/go-zookeeper/zk" gxset "github.com/dubbogo/gost/container/set" - gxzookeeper "github.com/dubbogo/gost/database/kv/zk" - perrors "github.com/pkg/errors" -) + gxzookeeper "github.com/dubbogo/gost/database/kv/zk" -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/config_center/parser" "dubbo.apache.org/dubbo-go/v3/remoting/zookeeper" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) const ( diff --git a/filter/accesslog/filter.go b/filter/accesslog/filter.go index 94a7a4c90a..ed46e6369d 100644 --- a/filter/accesslog/filter.go +++ b/filter/accesslog/filter.go @@ -25,14 +25,12 @@ import ( "strings" "sync" "time" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/filter/active/filter.go b/filter/active/filter.go index 8ee781b822..327ec0b995 100644 --- a/filter/active/filter.go +++ b/filter/active/filter.go @@ -21,14 +21,13 @@ import ( "context" "strconv" "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + invocation2 "dubbo.apache.org/dubbo-go/v3/protocol/invocation" ) diff --git a/filter/adaptivesvc/filter.go b/filter/adaptivesvc/filter.go index 2af36db11b..9b724b97b0 100644 --- a/filter/adaptivesvc/filter.go +++ b/filter/adaptivesvc/filter.go @@ -23,19 +23,14 @@ import ( "fmt" "strings" "sync" -) -import ( - "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/filter/adaptivesvc/limiter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + "github.com/pkg/errors" ) var ( diff --git a/filter/adaptivesvc/limiter/utils.go b/filter/adaptivesvc/limiter/utils.go index 18aa685805..77376f78f4 100644 --- a/filter/adaptivesvc/limiter/utils.go +++ b/filter/adaptivesvc/limiter/utils.go @@ -19,10 +19,8 @@ package limiter import ( "time" -) -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" ) func VerboseDebugf(msg string, args ...interface{}) { diff --git a/filter/auth/provider_auth_filter.go b/filter/auth/provider_auth_filter.go index 332ff43efa..db8185ea1f 100644 --- a/filter/auth/provider_auth_filter.go +++ b/filter/auth/provider_auth_filter.go @@ -20,14 +20,12 @@ package auth import ( "context" "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) var ( diff --git a/filter/auth/sign_util.go b/filter/auth/sign_util.go index 1f5afe39f9..76482a694c 100644 --- a/filter/auth/sign_util.go +++ b/filter/auth/sign_util.go @@ -24,10 +24,8 @@ import ( "encoding/json" "errors" "strings" -) -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" ) // Sign gets a signature string with given bytes diff --git a/filter/exec_limit/filter.go b/filter/exec_limit/filter.go index ed919a3746..82eb215618 100644 --- a/filter/exec_limit/filter.go +++ b/filter/exec_limit/filter.go @@ -47,17 +47,13 @@ import ( "strconv" "sync" "sync/atomic" -) - -import ( - "github.com/modern-go/concurrent" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" + "github.com/dubbogo/gost/log/logger" + "github.com/modern-go/concurrent" + _ "dubbo.apache.org/dubbo-go/v3/filter/handler" "dubbo.apache.org/dubbo-go/v3/protocol" ) diff --git a/filter/generic/filter.go b/filter/generic/filter.go index 6733d103a2..b560239354 100644 --- a/filter/generic/filter.go +++ b/filter/generic/filter.go @@ -21,18 +21,14 @@ package generic import ( "context" "sync" -) - -import ( - hessian "github.com/apache/dubbo-go-hessian2" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + hessian "github.com/apache/dubbo-go-hessian2" + "github.com/dubbogo/gost/log/logger" + invocation2 "dubbo.apache.org/dubbo-go/v3/protocol/invocation" ) diff --git a/filter/generic/generalizer/gson.go b/filter/generic/generalizer/gson.go index 7896071db9..b1690d5226 100644 --- a/filter/generic/generalizer/gson.go +++ b/filter/generic/generalizer/gson.go @@ -21,17 +21,12 @@ import ( "encoding/json" "reflect" "sync" -) -import ( hessian "github.com/apache/dubbo-go-hessian2" - perrors "github.com/pkg/errors" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/hessian2" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) var ( diff --git a/filter/generic/generalizer/map.go b/filter/generic/generalizer/map.go index 5aa573c372..bffec593c0 100644 --- a/filter/generic/generalizer/map.go +++ b/filter/generic/generalizer/map.go @@ -22,19 +22,13 @@ import ( "strings" "sync" "time" -) -import ( hessian "github.com/apache/dubbo-go-hessian2" - "github.com/mitchellh/mapstructure" - perrors "github.com/pkg/errors" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/hessian2" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) var ( diff --git a/filter/generic/service_filter.go b/filter/generic/service_filter.go index b8a09893b2..faf291139d 100644 --- a/filter/generic/service_filter.go +++ b/filter/generic/service_filter.go @@ -20,21 +20,17 @@ package generic import ( "context" "sync" -) -import ( hessian "github.com/apache/dubbo-go-hessian2" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + invocation2 "dubbo.apache.org/dubbo-go/v3/protocol/invocation" ) diff --git a/filter/generic/util.go b/filter/generic/util.go index 8bd05b92ad..244ec333bd 100644 --- a/filter/generic/util.go +++ b/filter/generic/util.go @@ -19,13 +19,11 @@ package generic import ( "strings" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter/generic/generalizer" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) // isCallingToGenericService check if it calls to a generic service diff --git a/filter/graceful_shutdown/consumer_filter.go b/filter/graceful_shutdown/consumer_filter.go index f49c66100b..b83dd0fef5 100644 --- a/filter/graceful_shutdown/consumer_filter.go +++ b/filter/graceful_shutdown/consumer_filter.go @@ -20,15 +20,13 @@ package graceful_shutdown import ( "context" "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) var ( diff --git a/filter/graceful_shutdown/provider_filter.go b/filter/graceful_shutdown/provider_filter.go index 784809f45e..b1745c7e3b 100644 --- a/filter/graceful_shutdown/provider_filter.go +++ b/filter/graceful_shutdown/provider_filter.go @@ -20,15 +20,13 @@ package graceful_shutdown import ( "context" "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) var ( diff --git a/filter/handler/rejected_execution_handler_only_log.go b/filter/handler/rejected_execution_handler_only_log.go index ac541d3fd9..e918d3a2bb 100644 --- a/filter/handler/rejected_execution_handler_only_log.go +++ b/filter/handler/rejected_execution_handler_only_log.go @@ -19,15 +19,13 @@ package handler import ( "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/filter/hystrix/filter.go b/filter/hystrix/filter.go index df8203e61f..b4b0b6e77f 100644 --- a/filter/hystrix/filter.go +++ b/filter/hystrix/filter.go @@ -24,23 +24,17 @@ import ( "reflect" "regexp" "sync" -) -import ( "github.com/afex/hystrix-go/hystrix" - perrors "github.com/pkg/errors" - - "gopkg.in/yaml.v2" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "gopkg.in/yaml.v2" ) const ( diff --git a/filter/seata/filter.go b/filter/seata/filter.go index 8d4757123d..a2d470499b 100644 --- a/filter/seata/filter.go +++ b/filter/seata/filter.go @@ -22,14 +22,12 @@ import ( "context" "strings" "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/filter/sentinel/filter.go b/filter/sentinel/filter.go index 06f6771876..627f94c53e 100644 --- a/filter/sentinel/filter.go +++ b/filter/sentinel/filter.go @@ -26,21 +26,16 @@ import ( "fmt" "strings" "sync" -) -import ( - sentinel "github.com/alibaba/sentinel-golang/api" - "github.com/alibaba/sentinel-golang/core/base" - "github.com/alibaba/sentinel-golang/logging" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + sentinel "github.com/alibaba/sentinel-golang/api" + "github.com/alibaba/sentinel-golang/core/base" + "github.com/alibaba/sentinel-golang/logging" + "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/filter/tps/filter.go b/filter/tps/filter.go index ff1531f5d5..5fa85811f1 100644 --- a/filter/tps/filter.go +++ b/filter/tps/filter.go @@ -34,14 +34,14 @@ package tps import ( "context" "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" + "github.com/dubbogo/gost/log/logger" + _ "dubbo.apache.org/dubbo-go/v3/filter/handler" + _ "dubbo.apache.org/dubbo-go/v3/filter/tps/limiter" "dubbo.apache.org/dubbo-go/v3/protocol" ) diff --git a/filter/tps/limiter/method_service.go b/filter/tps/limiter/method_service.go index 8925e042dc..4ffc493b6a 100644 --- a/filter/tps/limiter/method_service.go +++ b/filter/tps/limiter/method_service.go @@ -21,19 +21,14 @@ import ( "fmt" "strconv" "sync" -) -import ( - "github.com/modern-go/concurrent" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + "github.com/modern-go/concurrent" ) const ( diff --git a/filter/xds/cb/filter.go b/filter/xds/cb/filter.go index 50631bd809..39cf3aad66 100644 --- a/filter/xds/cb/filter.go +++ b/filter/xds/cb/filter.go @@ -19,18 +19,16 @@ package cb import ( "context" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/remoting/xds" "dubbo.apache.org/dubbo-go/v3/xds/client" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" + "github.com/dubbogo/gost/log/logger" ) // this should be executed before users set their own Tracer diff --git a/go.mod b/go.mod index ad4b7ac83e..20010c2fa9 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 github.com/creasty/defaults v1.5.2 github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 - github.com/dubbogo/gost v1.11.25 + github.com/dubbogo/gost v1.12.5 github.com/dubbogo/grpc-go v1.42.9 github.com/dubbogo/triple v1.1.8 github.com/emicklei/go-restful/v3 v3.8.0 diff --git a/go.sum b/go.sum index aed240940f..53ff1a441d 100644 --- a/go.sum +++ b/go.sum @@ -47,7 +47,6 @@ github.com/RoaringBitmap/roaring v1.1.0 h1:b10lZrZXaY6Q6EKIRrmOF519FIyQQ5anPgGr3 github.com/RoaringBitmap/roaring v1.1.0/go.mod h1:icnadbWcNyfEHlYdr+tDlOTih1Bf/h+rzPpv4sbomAA= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= @@ -174,8 +173,8 @@ github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5/go.mod h1:f github.com/dubbogo/gost v1.9.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8= github.com/dubbogo/gost v1.11.18/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI= github.com/dubbogo/gost v1.11.23/go.mod h1:PhJ8+qZJx+Txjx1KthNPuVkCvUca0jRLgKWj/noGgeI= -github.com/dubbogo/gost v1.11.25 h1:jFxE+YPh+ajrkHz7AxaaqYNMdKMDf/yfI1D+ZFoxfW0= -github.com/dubbogo/gost v1.11.25/go.mod h1:iovrPhv0hyakhQGVr4jwiECBL9HXNuBY4VV3HWK5pM0= +github.com/dubbogo/gost v1.12.5 h1:vpqQOAh5d1w/Qc+cvJmyiWRkwHFQPmZfgGwCBjuesBY= +github.com/dubbogo/gost v1.12.5/go.mod h1:f0bcP1xpBUdDgiNjNYKF6F3qlA+RFKs0k980FhoEn/g= github.com/dubbogo/grpc-go v1.42.9 h1:nTuglkH9rTJzQfardU4b0OJ0Imd2169dMNLBTNhTdlc= github.com/dubbogo/grpc-go v1.42.9/go.mod h1:F1T9hnUvYGW4JLK1QNriavpOkhusU677ovPzLkk6zHM= github.com/dubbogo/jsonparser v1.0.1/go.mod h1:tYAtpctvSP/tWw4MeelsowSPgXQRVHHWbqL6ynps8jU= @@ -249,8 +248,9 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= @@ -503,6 +503,8 @@ github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f/go.mod github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPpsiPUEh0zFL1Snz4crhMlBe60PYxRHr5oFF3rRYg0= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= @@ -611,6 +613,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/polarismesh/polaris-go v1.1.0 h1:nFvn3q3XaVFhzF7pBnIySrN0ZZBwvbbYXC5r2DpsQN0= github.com/polarismesh/polaris-go v1.1.0/go.mod h1:tquawfjEKp1W3ffNJQSzhfditjjoZ7tvhOCElN7Efzs= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= @@ -677,8 +681,9 @@ github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrY github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shirou/gopsutil v3.20.11+incompatible h1:LJr4ZQK4mPpIV5gOa4jCOKOGb4ty4DZO54I4FGqIpto= github.com/shirou/gopsutil v3.20.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shirou/gopsutil/v3 v3.21.6 h1:vU7jrp1Ic/2sHB7w6UNs7MIkn7ebVtTb5D9j45o9VYE= github.com/shirou/gopsutil/v3 v3.21.6/go.mod h1:JfVbDpIBLVzT8oKbvMg9P3wEIMDDpVn+LwHTKj0ST88= +github.com/shirou/gopsutil/v3 v3.22.2 h1:wCrArWFkHYIdDxx/FSfF5RB4dpJYW6t7rcp3+zL8uks= +github.com/shirou/gopsutil/v3 v3.22.2/go.mod h1:WapW1AOOPlHyXr+yOyw3uYx36enocrtSoSBy0L5vUHY= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -732,10 +737,14 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/tebeka/strftime v0.1.3/go.mod h1:7wJm3dZlpr4l/oVK0t1HYIc4rMzQ2XJlOMIUJUJH6XQ= github.com/tevid/gohamcrest v1.1.1 h1:ou+xSqlIw1xfGTg1uq1nif/htZ2S3EzRqLm2BP+tYU0= github.com/tevid/gohamcrest v1.1.1/go.mod h1:3UvtWlqm8j5JbwYZh80D/PVBt0mJ1eJiYgZMibh0H/k= -github.com/tklauser/go-sysconf v0.3.6 h1:oc1sJWvKkmvIxhDHeKWvZS4f6AW+YcoguSfRF2/Hmo4= github.com/tklauser/go-sysconf v0.3.6/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= -github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= +github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs= +github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= +github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= +github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8= +github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o= +github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -760,6 +769,8 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= +github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zouyx/agollo/v3 v3.4.5 h1:7YCxzY9ZYaH9TuVUBvmI6Tk0mwMggikah+cfbYogcHQ= github.com/zouyx/agollo/v3 v3.4.5/go.mod h1:LJr3kDmm23QSW+F1Ol4TMHDa7HvJvscMdVxJ2IpUTVc= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= @@ -963,6 +974,7 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -991,6 +1003,7 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201223074533-0d417f636930/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1004,9 +1017,12 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211106132015-ebca88c72f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/imports/imports.go b/imports/imports.go index fdb8458785..9318fcc524 100644 --- a/imports/imports.go +++ b/imports/imports.go @@ -33,7 +33,6 @@ import ( _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance/random" _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance/roundrobin" _ "dubbo.apache.org/dubbo-go/v3/cluster/router/meshrouter" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" _ "dubbo.apache.org/dubbo-go/v3/config_center/apollo" _ "dubbo.apache.org/dubbo-go/v3/config_center/nacos" _ "dubbo.apache.org/dubbo-go/v3/config_center/zookeeper" @@ -69,6 +68,7 @@ import ( _ "dubbo.apache.org/dubbo-go/v3/protocol/grpc" _ "dubbo.apache.org/dubbo-go/v3/protocol/jsonrpc" _ "dubbo.apache.org/dubbo-go/v3/protocol/rest" + _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" _ "dubbo.apache.org/dubbo-go/v3/registry/etcdv3" _ "dubbo.apache.org/dubbo-go/v3/registry/nacos" _ "dubbo.apache.org/dubbo-go/v3/registry/polaris" diff --git a/metadata/mapping/metadata/service_name_mapping.go b/metadata/mapping/metadata/service_name_mapping.go index 848b2d3c47..be2950f9c1 100644 --- a/metadata/mapping/metadata/service_name_mapping.go +++ b/metadata/mapping/metadata/service_name_mapping.go @@ -19,23 +19,18 @@ package metadata import ( "sync" -) -import ( gxset "github.com/dubbogo/gost/container/set" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/config/instance" "dubbo.apache.org/dubbo-go/v3/metadata/mapping" "dubbo.apache.org/dubbo-go/v3/metadata/report" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) const ( diff --git a/metadata/report/delegate/delegate_report.go b/metadata/report/delegate/delegate_report.go index d1e357129d..299c95bef9 100644 --- a/metadata/report/delegate/delegate_report.go +++ b/metadata/report/delegate/delegate_report.go @@ -22,23 +22,17 @@ import ( "runtime/debug" "sync" "time" -) -import ( "github.com/go-co-op/gocron" - perrors "github.com/pkg/errors" - - "go.uber.org/atomic" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config/instance" "dubbo.apache.org/dubbo-go/v3/metadata/definition" "dubbo.apache.org/dubbo-go/v3/metadata/identifier" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "go.uber.org/atomic" ) const ( diff --git a/metadata/report/delegate/delegate_report_test.go b/metadata/report/delegate/delegate_report_test.go index 343c8ab92b..b88d2d5c9c 100644 --- a/metadata/report/delegate/delegate_report_test.go +++ b/metadata/report/delegate/delegate_report_test.go @@ -21,21 +21,15 @@ import ( "fmt" "testing" "time" -) - -import ( - "github.com/stretchr/testify/assert" - - "go.uber.org/atomic" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config/instance" "dubbo.apache.org/dubbo-go/v3/metadata/definition" "dubbo.apache.org/dubbo-go/v3/metadata/identifier" + "github.com/dubbogo/gost/log/logger" + "github.com/stretchr/testify/assert" + "go.uber.org/atomic" ) func TestMetadataReport_MetadataReportRetry(t *testing.T) { diff --git a/metadata/report/etcd/report.go b/metadata/report/etcd/report.go index fadfb01506..9aa3ca873d 100644 --- a/metadata/report/etcd/report.go +++ b/metadata/report/etcd/report.go @@ -20,23 +20,19 @@ package etcd import ( "encoding/json" "strings" -) -import ( gxset "github.com/dubbogo/gost/container/set" - gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" - perrors "github.com/pkg/errors" -) + gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/metadata/identifier" "dubbo.apache.org/dubbo-go/v3/metadata/report" "dubbo.apache.org/dubbo-go/v3/metadata/report/factory" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) const DEFAULT_ROOT = "dubbo" diff --git a/metadata/report/nacos/report.go b/metadata/report/nacos/report.go index 3f20fc3634..219e027353 100644 --- a/metadata/report/nacos/report.go +++ b/metadata/report/nacos/report.go @@ -21,26 +21,21 @@ import ( "encoding/json" "net/url" "strings" -) -import ( gxset "github.com/dubbogo/gost/container/set" - nacosClient "github.com/dubbogo/gost/database/kv/nacos" + nacosClient "github.com/dubbogo/gost/database/kv/nacos" "github.com/nacos-group/nacos-sdk-go/vo" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/metadata/identifier" "dubbo.apache.org/dubbo-go/v3/metadata/report" "dubbo.apache.org/dubbo-go/v3/metadata/report/factory" "dubbo.apache.org/dubbo-go/v3/remoting/nacos" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) func init() { diff --git a/metadata/report/zookeeper/report.go b/metadata/report/zookeeper/report.go index f8594afb77..c3bafb1273 100644 --- a/metadata/report/zookeeper/report.go +++ b/metadata/report/zookeeper/report.go @@ -20,23 +20,19 @@ package zookeeper import ( "encoding/json" "strings" -) -import ( "github.com/dubbogo/go-zookeeper/zk" gxset "github.com/dubbogo/gost/container/set" - gxzookeeper "github.com/dubbogo/gost/database/kv/zk" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/metadata/identifier" "dubbo.apache.org/dubbo-go/v3/metadata/report" "dubbo.apache.org/dubbo-go/v3/metadata/report/factory" + gxzookeeper "github.com/dubbogo/gost/database/kv/zk" + "github.com/dubbogo/gost/log/logger" ) var emptyStrSlice = make([]string, 0) diff --git a/metadata/service/exporter/configurable/exporter.go b/metadata/service/exporter/configurable/exporter.go index a074d6ecc0..6e78b28aab 100644 --- a/metadata/service/exporter/configurable/exporter.go +++ b/metadata/service/exporter/configurable/exporter.go @@ -19,18 +19,19 @@ package configurable import ( "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" + "github.com/dubbogo/gost/log/logger" + _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/metadata" "dubbo.apache.org/dubbo-go/v3/metadata/service" "dubbo.apache.org/dubbo-go/v3/metadata/service/exporter" + _ "dubbo.apache.org/dubbo-go/v3/metadata/service/remote" + _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" ) diff --git a/metadata/service/exporter/configurable/exporter_test.go b/metadata/service/exporter/configurable/exporter_test.go index da42bf4165..12bb401e10 100644 --- a/metadata/service/exporter/configurable/exporter_test.go +++ b/metadata/service/exporter/configurable/exporter_test.go @@ -19,19 +19,18 @@ package configurable import ( "testing" -) -import ( + "dubbo.apache.org/dubbo-go/v3/common" "github.com/stretchr/testify/assert" -) -import ( - "dubbo.apache.org/dubbo-go/v3/common" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" "dubbo.apache.org/dubbo-go/v3/config" + _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" + _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" + _ "dubbo.apache.org/dubbo-go/v3/metrics/prometheus" + _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" "dubbo.apache.org/dubbo-go/v3/remoting/getty" ) diff --git a/metadata/service/local/metadata_service_proxy_factory.go b/metadata/service/local/metadata_service_proxy_factory.go index ee9c2921ff..090ca19f74 100644 --- a/metadata/service/local/metadata_service_proxy_factory.go +++ b/metadata/service/local/metadata_service_proxy_factory.go @@ -20,15 +20,13 @@ package local import ( "encoding/json" "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/metadata/service" "dubbo.apache.org/dubbo-go/v3/registry" + "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/metadata/service/local/service.go b/metadata/service/local/service.go index 6761277ad5..9696314ea4 100644 --- a/metadata/service/local/service.go +++ b/metadata/service/local/service.go @@ -20,20 +20,15 @@ package local import ( "sort" "sync" -) -import ( - "github.com/Workiva/go-datastructures/slice/skip" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/metadata/definition" "dubbo.apache.org/dubbo-go/v3/metadata/service" + "github.com/Workiva/go-datastructures/slice/skip" + "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/metadata/service/local/service_proxy.go b/metadata/service/local/service_proxy.go index b5f95457a5..dcee0887d0 100644 --- a/metadata/service/local/service_proxy.go +++ b/metadata/service/local/service_proxy.go @@ -20,14 +20,12 @@ package local import ( "context" "reflect" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" + "github.com/dubbogo/gost/log/logger" ) // MetadataServiceProxy actually is a RPC stub which will only be used by client-side. diff --git a/metadata/service/remote/service.go b/metadata/service/remote/service.go index 0c8ee8f004..30dc0bf6a4 100644 --- a/metadata/service/remote/service.go +++ b/metadata/service/remote/service.go @@ -19,23 +19,18 @@ package remote import ( "sync" -) -import ( - "go.uber.org/atomic" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/metadata/definition" "dubbo.apache.org/dubbo-go/v3/metadata/identifier" "dubbo.apache.org/dubbo-go/v3/metadata/report/delegate" "dubbo.apache.org/dubbo-go/v3/metadata/service" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" "dubbo.apache.org/dubbo-go/v3/registry" + "github.com/dubbogo/gost/log/logger" + "go.uber.org/atomic" ) type MetadataService struct { diff --git a/metadata/service/remote/service_test.go b/metadata/service/remote/service_test.go index 0ea7121c8d..7c1331ad37 100644 --- a/metadata/service/remote/service_test.go +++ b/metadata/service/remote/service_test.go @@ -20,24 +20,18 @@ package remote import ( "fmt" "testing" -) - -import ( - gxset "github.com/dubbogo/gost/container/set" - - "github.com/stretchr/testify/assert" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config/instance" "dubbo.apache.org/dubbo-go/v3/metadata/definition" "dubbo.apache.org/dubbo-go/v3/metadata/identifier" "dubbo.apache.org/dubbo-go/v3/metadata/report" "dubbo.apache.org/dubbo-go/v3/metadata/report/factory" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" + gxset "github.com/dubbogo/gost/container/set" + "github.com/dubbogo/gost/log/logger" + "github.com/stretchr/testify/assert" ) var ( diff --git a/metrics/prometheus/reporter.go b/metrics/prometheus/reporter.go index cee640ebd0..9f475a95a4 100644 --- a/metrics/prometheus/reporter.go +++ b/metrics/prometheus/reporter.go @@ -24,22 +24,17 @@ import ( "strings" "sync" "time" -) -import ( ocprom "contrib.go.opencensus.io/exporter/prometheus" - "github.com/prometheus/client_golang/prometheus" - prom "github.com/prometheus/client_golang/prometheus" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/metrics" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + prom "github.com/prometheus/client_golang/prometheus" ) const ( diff --git a/protocol/dubbo/dubbo_codec.go b/protocol/dubbo/dubbo_codec.go index 5f287c3159..ec62040178 100644 --- a/protocol/dubbo/dubbo_codec.go +++ b/protocol/dubbo/dubbo_codec.go @@ -21,19 +21,15 @@ import ( "bytes" "strconv" "time" -) -import ( hessian "github.com/apache/dubbo-go-hessian2" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + invct "dubbo.apache.org/dubbo-go/v3/protocol/invocation" "dubbo.apache.org/dubbo-go/v3/remoting" ) diff --git a/protocol/dubbo/dubbo_exporter.go b/protocol/dubbo/dubbo_exporter.go index 655c28e4d4..12a75b7287 100644 --- a/protocol/dubbo/dubbo_exporter.go +++ b/protocol/dubbo/dubbo_exporter.go @@ -19,13 +19,11 @@ package dubbo import ( "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) // DubboExporter is dubbo service exporter. diff --git a/protocol/dubbo/dubbo_invoker.go b/protocol/dubbo/dubbo_invoker.go index bbf3a25ea1..a24f25c0a4 100644 --- a/protocol/dubbo/dubbo_invoker.go +++ b/protocol/dubbo/dubbo_invoker.go @@ -23,18 +23,14 @@ import ( "strings" "sync" "time" -) - -import ( - "github.com/opentracing/opentracing-go" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + "github.com/opentracing/opentracing-go" + invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation" "dubbo.apache.org/dubbo-go/v3/remoting" ) diff --git a/protocol/dubbo/dubbo_invoker_test.go b/protocol/dubbo/dubbo_invoker_test.go index 8d12bba69e..e7a3f28534 100644 --- a/protocol/dubbo/dubbo_invoker_test.go +++ b/protocol/dubbo/dubbo_invoker_test.go @@ -39,7 +39,7 @@ package dubbo //import ( // "dubbo.apache.org/dubbo-go/v3/common" // "dubbo.apache.org/dubbo-go/v3/common/constant" -// "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" +// "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" // "dubbo.apache.org/dubbo-go/v3/protocol" // "dubbo.apache.org/dubbo-go/v3/protocol/invocation" // "dubbo.apache.org/dubbo-go/v3/remoting" diff --git a/protocol/dubbo/dubbo_protocol.go b/protocol/dubbo/dubbo_protocol.go index 6aa633b018..f879b2639c 100644 --- a/protocol/dubbo/dubbo_protocol.go +++ b/protocol/dubbo/dubbo_protocol.go @@ -22,21 +22,16 @@ import ( "fmt" "sync" "time" -) -import ( - "github.com/opentracing/opentracing-go" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" "dubbo.apache.org/dubbo-go/v3/remoting" "dubbo.apache.org/dubbo-go/v3/remoting/getty" + "github.com/dubbogo/gost/log/logger" + "github.com/opentracing/opentracing-go" ) const ( diff --git a/protocol/dubbo/dubbo_protocol_test.go b/protocol/dubbo/dubbo_protocol_test.go index d6d3b376bf..1b3358b896 100644 --- a/protocol/dubbo/dubbo_protocol_test.go +++ b/protocol/dubbo/dubbo_protocol_test.go @@ -19,18 +19,13 @@ package dubbo import ( "testing" -) -import ( - "github.com/stretchr/testify/assert" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" "dubbo.apache.org/dubbo-go/v3/protocol" + "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" "dubbo.apache.org/dubbo-go/v3/remoting/getty" + "github.com/stretchr/testify/assert" ) const ( diff --git a/protocol/dubbo/hessian2/hessian_request.go b/protocol/dubbo/hessian2/hessian_request.go index 11c407a25e..797c01645e 100644 --- a/protocol/dubbo/hessian2/hessian_request.go +++ b/protocol/dubbo/hessian2/hessian_request.go @@ -22,18 +22,13 @@ import ( "strconv" "strings" "time" -) -import ( hessian "github.com/apache/dubbo-go-hessian2" + "github.com/dubbogo/gost/log/logger" perrors "github.com/pkg/errors" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" -) - func getArgType(v interface{}) string { return GetClassDesc(v) } diff --git a/protocol/dubbo/hessian2/hessian_response.go b/protocol/dubbo/hessian2/hessian_response.go index 51bc725809..e5381be402 100644 --- a/protocol/dubbo/hessian2/hessian_response.go +++ b/protocol/dubbo/hessian2/hessian_response.go @@ -23,19 +23,14 @@ import ( "reflect" "strconv" "strings" -) -import ( hessian "github.com/apache/dubbo-go-hessian2" "github.com/apache/dubbo-go-hessian2/java_exception" + "github.com/dubbogo/gost/log/logger" perrors "github.com/pkg/errors" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" -) - // DubboResponse dubbo response type DubboResponse struct { RspObj interface{} diff --git a/protocol/dubbo/impl/codec.go b/protocol/dubbo/impl/codec.go index 46e8dadba7..a89741c886 100644 --- a/protocol/dubbo/impl/codec.go +++ b/protocol/dubbo/impl/codec.go @@ -20,18 +20,13 @@ package impl import ( "bufio" "encoding/binary" -) -import ( hessian "github.com/apache/dubbo-go-hessian2" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) type ProtocolCodec struct { diff --git a/protocol/dubbo/impl/hessian.go b/protocol/dubbo/impl/hessian.go index c235843669..438bf94358 100644 --- a/protocol/dubbo/impl/hessian.go +++ b/protocol/dubbo/impl/hessian.go @@ -23,19 +23,14 @@ import ( "strconv" "strings" "time" -) -import ( hessian "github.com/apache/dubbo-go-hessian2" "github.com/apache/dubbo-go-hessian2/java_exception" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) type HessianSerializer struct{} diff --git a/protocol/dubbo3/dubbo3_exporter.go b/protocol/dubbo3/dubbo3_exporter.go index a8ac595433..2a96be2513 100644 --- a/protocol/dubbo3/dubbo3_exporter.go +++ b/protocol/dubbo3/dubbo3_exporter.go @@ -19,17 +19,12 @@ package dubbo3 import ( "sync" -) -import ( - tripleConstant "github.com/dubbogo/triple/pkg/common/constant" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + tripleConstant "github.com/dubbogo/triple/pkg/common/constant" ) // DubboExporter is dubbo3 service exporter. diff --git a/protocol/dubbo3/dubbo3_invoker.go b/protocol/dubbo3/dubbo3_invoker.go index b87c0de97c..4255cb0e5d 100644 --- a/protocol/dubbo3/dubbo3_invoker.go +++ b/protocol/dubbo3/dubbo3_invoker.go @@ -24,22 +24,19 @@ import ( "strings" "sync" "time" -) -import ( "github.com/dubbogo/grpc-go/metadata" tripleConstant "github.com/dubbogo/triple/pkg/common/constant" - triConfig "github.com/dubbogo/triple/pkg/config" - "github.com/dubbogo/triple/pkg/triple" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + triConfig "github.com/dubbogo/triple/pkg/config" + "github.com/dubbogo/triple/pkg/triple" + invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation" ) diff --git a/protocol/dubbo3/dubbo3_protocol.go b/protocol/dubbo3/dubbo3_protocol.go index 10a932e2b9..c5e41eb132 100644 --- a/protocol/dubbo3/dubbo3_protocol.go +++ b/protocol/dubbo3/dubbo3_protocol.go @@ -23,25 +23,21 @@ import ( "reflect" "strconv" "sync" -) -import ( "github.com/dubbogo/grpc-go" "github.com/dubbogo/grpc-go/metadata" tripleConstant "github.com/dubbogo/triple/pkg/common/constant" - triConfig "github.com/dubbogo/triple/pkg/config" - "github.com/dubbogo/triple/pkg/triple" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" + "github.com/dubbogo/gost/log/logger" + triConfig "github.com/dubbogo/triple/pkg/config" + "github.com/dubbogo/triple/pkg/triple" ) var protocolOnce sync.Once diff --git a/protocol/dubbo3/internal/server.go b/protocol/dubbo3/internal/server.go index 79ce4797e7..12a4e2373b 100644 --- a/protocol/dubbo3/internal/server.go +++ b/protocol/dubbo3/internal/server.go @@ -19,14 +19,15 @@ package internal import ( "context" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" - log "dubbo.apache.org/dubbo-go/v3/common/logger" - _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" + log "github.com/dubbogo/gost/log/logger" + "dubbo.apache.org/dubbo-go/v3/config" + _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" + _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" + _ "dubbo.apache.org/dubbo-go/v3/metrics/prometheus" ) diff --git a/protocol/grpc/client.go b/protocol/grpc/client.go index b6f2b03f58..3d55b2fb99 100644 --- a/protocol/grpc/client.go +++ b/protocol/grpc/client.go @@ -22,25 +22,17 @@ import ( "strconv" "sync" "time" -) -import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/config" + "github.com/dubbogo/gost/log/logger" "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc" - "github.com/opentracing/opentracing-go" - "google.golang.org/grpc" - "gopkg.in/yaml.v2" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" - "dubbo.apache.org/dubbo-go/v3/config" -) - var clientConf *ClientConfig var clientConfInitOnce sync.Once diff --git a/protocol/grpc/grpc_exporter.go b/protocol/grpc/grpc_exporter.go index a5f00450d0..e50dc451b9 100644 --- a/protocol/grpc/grpc_exporter.go +++ b/protocol/grpc/grpc_exporter.go @@ -19,13 +19,11 @@ package grpc import ( "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) // nolint diff --git a/protocol/grpc/grpc_invoker.go b/protocol/grpc/grpc_invoker.go index 8c535c5661..e14da8f790 100644 --- a/protocol/grpc/grpc_invoker.go +++ b/protocol/grpc/grpc_invoker.go @@ -21,22 +21,15 @@ import ( "context" "reflect" "sync" -) -import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/protocol" hessian2 "github.com/apache/dubbo-go-hessian2" - + "github.com/dubbogo/gost/log/logger" "github.com/pkg/errors" - "google.golang.org/grpc/connectivity" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" - "dubbo.apache.org/dubbo-go/v3/protocol" -) - var errNoReply = errors.New("request need @response") // nolint diff --git a/protocol/grpc/grpc_protocol.go b/protocol/grpc/grpc_protocol.go index 6b8596b725..df18646e76 100644 --- a/protocol/grpc/grpc_protocol.go +++ b/protocol/grpc/grpc_protocol.go @@ -20,14 +20,12 @@ package grpc import ( "strconv" "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/protocol/grpc/internal/helloworld/server.go b/protocol/grpc/internal/helloworld/server.go index cf12571f6a..176bc3a666 100644 --- a/protocol/grpc/internal/helloworld/server.go +++ b/protocol/grpc/internal/helloworld/server.go @@ -20,14 +20,10 @@ package helloworld import ( "context" "net" -) -import ( "google.golang.org/grpc" -) -import ( - log "dubbo.apache.org/dubbo-go/v3/common/logger" + log "github.com/dubbogo/gost/log/logger" ) // server is used to implement helloworld.GreeterServer. diff --git a/protocol/grpc/internal/routeguide/client.go b/protocol/grpc/internal/routeguide/client.go index 8e9bdbe145..2b2382af48 100644 --- a/protocol/grpc/internal/routeguide/client.go +++ b/protocol/grpc/internal/routeguide/client.go @@ -21,11 +21,9 @@ import ( "io" "math/rand" "time" -) -import ( - log "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" + log "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/protocol/grpc/internal/routeguide/server.go b/protocol/grpc/internal/routeguide/server.go index d13fab5d71..d4aa757073 100644 --- a/protocol/grpc/internal/routeguide/server.go +++ b/protocol/grpc/internal/routeguide/server.go @@ -26,16 +26,11 @@ import ( "net" "sync" "time" -) -import ( "github.com/golang/protobuf/proto" - "google.golang.org/grpc" -) -import ( - log "dubbo.apache.org/dubbo-go/v3/common/logger" + log "github.com/dubbogo/gost/log/logger" ) type routeGuideServer struct { diff --git a/protocol/grpc/server.go b/protocol/grpc/server.go index dc16074f7c..5f40e83373 100644 --- a/protocol/grpc/server.go +++ b/protocol/grpc/server.go @@ -22,24 +22,17 @@ import ( "net" "sync" "time" -) -import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/config" + "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc" - "github.com/opentracing/opentracing-go" - "google.golang.org/grpc" "google.golang.org/grpc/reflection" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" - "dubbo.apache.org/dubbo-go/v3/config" - "dubbo.apache.org/dubbo-go/v3/protocol" -) - // DubboGrpcService is gRPC service type DubboGrpcService interface { // SetProxyImpl sets proxy. diff --git a/protocol/invoker.go b/protocol/invoker.go index e219c4d535..422d7f425e 100644 --- a/protocol/invoker.go +++ b/protocol/invoker.go @@ -20,17 +20,12 @@ package protocol import ( "context" "fmt" -) -import ( perrors "github.com/pkg/errors" - uatomic "go.uber.org/atomic" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" + uatomic "go.uber.org/atomic" ) var ( diff --git a/protocol/jsonrpc/http.go b/protocol/jsonrpc/http.go index f111534843..6606c75234 100644 --- a/protocol/jsonrpc/http.go +++ b/protocol/jsonrpc/http.go @@ -30,18 +30,13 @@ import ( "strings" "sync/atomic" "time" -) -import ( "github.com/opentracing/opentracing-go" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) // Request is HTTP protocol request diff --git a/protocol/jsonrpc/http_test.go b/protocol/jsonrpc/http_test.go index 855c918b62..f62d6841a4 100644 --- a/protocol/jsonrpc/http_test.go +++ b/protocol/jsonrpc/http_test.go @@ -19,9 +19,7 @@ package jsonrpc import ( "context" -) -import ( perrors "github.com/pkg/errors" ) @@ -44,7 +42,7 @@ import ( //import ( // "dubbo.apache.org/dubbo-go/v3/common" // "dubbo.apache.org/dubbo-go/v3/common/constant" -// "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" +// "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" // "dubbo.apache.org/dubbo-go/v3/protocol" //) // diff --git a/protocol/jsonrpc/jsonrpc_exporter.go b/protocol/jsonrpc/jsonrpc_exporter.go index a1b85a0147..3a686f295c 100644 --- a/protocol/jsonrpc/jsonrpc_exporter.go +++ b/protocol/jsonrpc/jsonrpc_exporter.go @@ -19,13 +19,11 @@ package jsonrpc import ( "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) // JsonrpcExporter is JSON RPC exporter and extends from base invoker. diff --git a/protocol/jsonrpc/jsonrpc_invoker.go b/protocol/jsonrpc/jsonrpc_invoker.go index 03b3280640..e4e59f4a4a 100644 --- a/protocol/jsonrpc/jsonrpc_invoker.go +++ b/protocol/jsonrpc/jsonrpc_invoker.go @@ -19,13 +19,12 @@ package jsonrpc import ( "context" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation" ) diff --git a/protocol/jsonrpc/jsonrpc_invoker_test.go b/protocol/jsonrpc/jsonrpc_invoker_test.go index 6f762fe2ea..f2c2deb6b7 100644 --- a/protocol/jsonrpc/jsonrpc_invoker_test.go +++ b/protocol/jsonrpc/jsonrpc_invoker_test.go @@ -30,7 +30,7 @@ package jsonrpc // //import ( // "dubbo.apache.org/dubbo-go/v3/common" -// "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" +// "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" // "dubbo.apache.org/dubbo-go/v3/protocol" // "dubbo.apache.org/dubbo-go/v3/protocol/invocation" //) diff --git a/protocol/jsonrpc/jsonrpc_protocol.go b/protocol/jsonrpc/jsonrpc_protocol.go index d5bcf965d5..3bb79fa2ed 100644 --- a/protocol/jsonrpc/jsonrpc_protocol.go +++ b/protocol/jsonrpc/jsonrpc_protocol.go @@ -21,15 +21,13 @@ import ( "strings" "sync" "time" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/protocol/jsonrpc/server.go b/protocol/jsonrpc/server.go index 340849c337..392385d685 100644 --- a/protocol/jsonrpc/server.go +++ b/protocol/jsonrpc/server.go @@ -29,19 +29,14 @@ import ( "runtime/debug" "sync" "time" -) -import ( "github.com/opentracing/opentracing-go" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) // A value sent as a placeholder for the server's response value when the server diff --git a/protocol/protocol.go b/protocol/protocol.go index c8f9893d80..29ddd6f72a 100644 --- a/protocol/protocol.go +++ b/protocol/protocol.go @@ -19,11 +19,9 @@ package protocol import ( "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" ) // Protocol is the interface that wraps the basic Export、 Refer and Destroy method. diff --git a/protocol/protocolwrapper/protocol_filter_wrapper.go b/protocol/protocolwrapper/protocol_filter_wrapper.go index 548a1f524b..6d00debb4b 100644 --- a/protocol/protocolwrapper/protocol_filter_wrapper.go +++ b/protocol/protocolwrapper/protocol_filter_wrapper.go @@ -20,15 +20,13 @@ package protocolwrapper import ( "context" "strings" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/protocol/protocolwrapper/protocol_filter_wrapper_test.go b/protocol/protocolwrapper/protocol_filter_wrapper_test.go index 7862e4e176..89f2b9a886 100644 --- a/protocol/protocolwrapper/protocol_filter_wrapper_test.go +++ b/protocol/protocolwrapper/protocol_filter_wrapper_test.go @@ -21,19 +21,14 @@ import ( "context" "net/url" "testing" -) -import ( - "github.com/stretchr/testify/assert" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + "github.com/stretchr/testify/assert" ) const mockFilterKey = "mockEcho" diff --git a/protocol/rest/config/reader/rest_config_reader.go b/protocol/rest/config/reader/rest_config_reader.go index 6bfe5c2caa..6365d89814 100644 --- a/protocol/rest/config/reader/rest_config_reader.go +++ b/protocol/rest/config/reader/rest_config_reader.go @@ -21,20 +21,14 @@ import ( "bytes" "strconv" "strings" -) - -import ( - perrors "github.com/pkg/errors" - - "gopkg.in/yaml.v2" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config/interfaces" "dubbo.apache.org/dubbo-go/v3/protocol/rest/config" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "gopkg.in/yaml.v2" ) const REST = "rest" diff --git a/protocol/rest/config/reader/rest_config_reader_test.go b/protocol/rest/config/reader/rest_config_reader_test.go index 78acde21fe..de482821e1 100644 --- a/protocol/rest/config/reader/rest_config_reader_test.go +++ b/protocol/rest/config/reader/rest_config_reader_test.go @@ -20,15 +20,10 @@ package reader import ( "bytes" "testing" -) -import ( - "github.com/stretchr/testify/assert" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/yaml" "dubbo.apache.org/dubbo-go/v3/protocol/rest/config" + "github.com/dubbogo/gost/encoding/yaml" + "github.com/stretchr/testify/assert" ) func TestRestConfigReaderReadConsumerConfig(t *testing.T) { diff --git a/protocol/rest/rest_exporter.go b/protocol/rest/rest_exporter.go index b3e3a4814c..81ae543bfe 100644 --- a/protocol/rest/rest_exporter.go +++ b/protocol/rest/rest_exporter.go @@ -19,13 +19,11 @@ package rest import ( "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" ) // nolint diff --git a/protocol/rest/rest_protocol.go b/protocol/rest/rest_protocol.go index 32d007aa7c..cdf223a31b 100644 --- a/protocol/rest/rest_protocol.go +++ b/protocol/rest/rest_protocol.go @@ -20,19 +20,21 @@ package rest import ( "sync" "time" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/rest/client" + "github.com/dubbogo/gost/log/logger" + _ "dubbo.apache.org/dubbo-go/v3/protocol/rest/client/client_impl" + rest_config "dubbo.apache.org/dubbo-go/v3/protocol/rest/config" + _ "dubbo.apache.org/dubbo-go/v3/protocol/rest/config/reader" "dubbo.apache.org/dubbo-go/v3/protocol/rest/server" + _ "dubbo.apache.org/dubbo-go/v3/protocol/rest/server/server_impl" ) diff --git a/protocol/rest/rest_protocol_test.go b/protocol/rest/rest_protocol_test.go index 8d45399e66..d216217a63 100644 --- a/protocol/rest/rest_protocol_test.go +++ b/protocol/rest/rest_protocol_test.go @@ -34,7 +34,7 @@ package rest //import ( // "dubbo.apache.org/dubbo-go/v3/common" // "dubbo.apache.org/dubbo-go/v3/common/extension" -// _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" +// _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" // "dubbo.apache.org/dubbo-go/v3/config" // rest_config "dubbo.apache.org/dubbo-go/v3/protocol/rest/config" //) diff --git a/protocol/rest/server/rest_server.go b/protocol/rest/server/rest_server.go index 328d1480cf..09c71c8502 100644 --- a/protocol/rest/server/rest_server.go +++ b/protocol/rest/server/rest_server.go @@ -23,17 +23,13 @@ import ( "net/http" "reflect" "strconv" -) - -import ( - perrors "github.com/pkg/errors" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + rest_config "dubbo.apache.org/dubbo-go/v3/protocol/rest/config" ) diff --git a/protocol/rest/server/server_impl/go_restful_server.go b/protocol/rest/server/server_impl/go_restful_server.go index 77ed67dadd..a9184f4364 100644 --- a/protocol/rest/server/server_impl/go_restful_server.go +++ b/protocol/rest/server/server_impl/go_restful_server.go @@ -24,21 +24,16 @@ import ( "net/http" "strings" "time" -) -import ( "github.com/emicklei/go-restful/v3" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol/rest/config" "dubbo.apache.org/dubbo-go/v3/protocol/rest/server" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) func init() { diff --git a/protocol/rpc_status.go b/protocol/rpc_status.go index f2b2aa4e0d..821fe164d9 100644 --- a/protocol/rpc_status.go +++ b/protocol/rpc_status.go @@ -21,16 +21,11 @@ import ( "sync" "sync/atomic" "time" -) -import ( - uberAtomic "go.uber.org/atomic" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" + uberAtomic "go.uber.org/atomic" ) var ( diff --git a/registry/base_configuration_listener.go b/registry/base_configuration_listener.go index f82e834d2a..484fe0ac7e 100644 --- a/registry/base_configuration_listener.go +++ b/registry/base_configuration_listener.go @@ -17,17 +17,14 @@ package registry -import ( - perrors "github.com/pkg/errors" -) - import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/config" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) // nolint diff --git a/registry/base_registry.go b/registry/base_registry.go index 1016d88c07..80a54bf075 100644 --- a/registry/base_registry.go +++ b/registry/base_registry.go @@ -25,16 +25,11 @@ import ( "strings" "sync" "time" -) -import ( - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) const ( diff --git a/registry/directory/directory.go b/registry/directory/directory.go index 47337954e1..dd91860a57 100644 --- a/registry/directory/directory.go +++ b/registry/directory/directory.go @@ -22,13 +22,7 @@ import ( "net/url" "os" "sync" -) - -import ( - perrors "github.com/pkg/errors" -) -import ( "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/cluster/directory/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory/static" @@ -36,9 +30,11 @@ import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/config_center" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + _ "dubbo.apache.org/dubbo-go/v3/config_center/configurator" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper" diff --git a/registry/etcdv3/listener.go b/registry/etcdv3/listener.go index 92e55aa093..f602eca7f6 100644 --- a/registry/etcdv3/listener.go +++ b/registry/etcdv3/listener.go @@ -20,20 +20,15 @@ package etcdv3 import ( "strings" "sync" -) -import ( gxchan "github.com/dubbogo/gost/container/chan" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) type dataListener struct { diff --git a/registry/etcdv3/registry.go b/registry/etcdv3/registry.go index d2773312e9..173614e8c5 100644 --- a/registry/etcdv3/registry.go +++ b/registry/etcdv3/registry.go @@ -22,21 +22,16 @@ import ( "path" "strings" "sync" -) -import ( gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting/etcdv3" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) const ( diff --git a/registry/etcdv3/service_discovery.go b/registry/etcdv3/service_discovery.go index 3f5d31b80d..ba443e12bd 100644 --- a/registry/etcdv3/service_discovery.go +++ b/registry/etcdv3/service_discovery.go @@ -21,24 +21,20 @@ import ( "fmt" "strings" "sync" -) -import ( gxset "github.com/dubbogo/gost/container/set" - gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" - gxpage "github.com/dubbogo/gost/hash/page" - "github.com/hashicorp/vault/sdk/helper/jsonutil" -) + gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" "dubbo.apache.org/dubbo-go/v3/remoting/etcdv3" + gxpage "github.com/dubbogo/gost/hash/page" + "github.com/dubbogo/gost/log/logger" + "github.com/hashicorp/vault/sdk/helper/jsonutil" ) const ( diff --git a/registry/event.go b/registry/event.go index 5d46f02d68..e72128c517 100644 --- a/registry/event.go +++ b/registry/event.go @@ -21,12 +21,10 @@ import ( "fmt" "math/rand" "time" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/observer" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/gof/observer" ) type KeyFunc func(*common.URL) string diff --git a/registry/event/base_configuration_listener.go b/registry/event/base_configuration_listener.go index a9e2106fec..7ffb85bcbd 100644 --- a/registry/event/base_configuration_listener.go +++ b/registry/event/base_configuration_listener.go @@ -17,17 +17,14 @@ package event -import ( - perrors "github.com/pkg/errors" -) - import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/config" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) // nolint diff --git a/registry/event/metadata_service_url_params_customizer.go b/registry/event/metadata_service_url_params_customizer.go index 4b599d8b6a..679de73142 100644 --- a/registry/event/metadata_service_url_params_customizer.go +++ b/registry/event/metadata_service_url_params_customizer.go @@ -19,19 +19,14 @@ package event import ( "encoding/json" -) -import ( - gxset "github.com/dubbogo/gost/container/set" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" "dubbo.apache.org/dubbo-go/v3/registry" + gxset "github.com/dubbogo/gost/container/set" + "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/registry/event/protocol_ports_metadata_customizer.go b/registry/event/protocol_ports_metadata_customizer.go index 7113fa4e90..8188d4c4da 100644 --- a/registry/event/protocol_ports_metadata_customizer.go +++ b/registry/event/protocol_ports_metadata_customizer.go @@ -20,14 +20,12 @@ package event import ( "encoding/json" "strconv" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" "dubbo.apache.org/dubbo-go/v3/registry" + "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/registry/event/service_instances_changed_listener_impl.go b/registry/event/service_instances_changed_listener_impl.go index e3f20992c0..82eb81cf25 100644 --- a/registry/event/service_instances_changed_listener_impl.go +++ b/registry/event/service_instances_changed_listener_impl.go @@ -19,20 +19,15 @@ package event import ( "reflect" -) -import ( - gxset "github.com/dubbogo/gost/container/set" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" - "dubbo.apache.org/dubbo-go/v3/common/observer" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" + gxset "github.com/dubbogo/gost/container/set" + "github.com/dubbogo/gost/gof/observer" + "github.com/dubbogo/gost/log/logger" ) // ServiceInstancesChangedListenerImpl The Service Discovery Changed Event Listener diff --git a/registry/event/service_revision_customizer.go b/registry/event/service_revision_customizer.go index c648eedd94..458b12a76c 100644 --- a/registry/event/service_revision_customizer.go +++ b/registry/event/service_revision_customizer.go @@ -21,15 +21,13 @@ import ( "fmt" "hash/crc32" "sort" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" "dubbo.apache.org/dubbo-go/v3/registry" + "github.com/dubbogo/gost/log/logger" ) const defaultRevision = "N/A" diff --git a/registry/mock_registry.go b/registry/mock_registry.go index fe9b0078b3..461ca8a2fa 100644 --- a/registry/mock_registry.go +++ b/registry/mock_registry.go @@ -20,15 +20,10 @@ package registry import ( "fmt" "time" -) -import ( - "go.uber.org/atomic" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" + "go.uber.org/atomic" ) // MockRegistry is used as mock registry diff --git a/registry/nacos/listener.go b/registry/nacos/listener.go index 92b4e7742f..c200f8ff94 100644 --- a/registry/nacos/listener.go +++ b/registry/nacos/listener.go @@ -23,25 +23,20 @@ import ( "reflect" "strconv" "sync" -) -import ( gxchan "github.com/dubbogo/gost/container/chan" - nacosClient "github.com/dubbogo/gost/database/kv/nacos" + nacosClient "github.com/dubbogo/gost/database/kv/nacos" "github.com/nacos-group/nacos-sdk-go/model" "github.com/nacos-group/nacos-sdk-go/vo" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) var ( diff --git a/registry/nacos/registry.go b/registry/nacos/registry.go index 579cfef404..c50a140006 100644 --- a/registry/nacos/registry.go +++ b/registry/nacos/registry.go @@ -22,23 +22,17 @@ import ( "strconv" "strings" "time" -) -import ( nacosClient "github.com/dubbogo/gost/database/kv/nacos" - "github.com/nacos-group/nacos-sdk-go/vo" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting/nacos" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) var localIP = "" diff --git a/registry/nacos/service_discovery.go b/registry/nacos/service_discovery.go index 750b30561d..dff674f726 100644 --- a/registry/nacos/service_discovery.go +++ b/registry/nacos/service_discovery.go @@ -20,26 +20,21 @@ package nacos import ( "fmt" "sync" -) -import ( - "github.com/dubbogo/gost/container/set" + gxset "github.com/dubbogo/gost/container/set" nacosClient "github.com/dubbogo/gost/database/kv/nacos" - "github.com/dubbogo/gost/hash/page" + gxpage "github.com/dubbogo/gost/hash/page" "github.com/nacos-group/nacos-sdk-go/model" "github.com/nacos-group/nacos-sdk-go/vo" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting/nacos" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) const ( diff --git a/registry/polaris/listener.go b/registry/polaris/listener.go index 4da78caa9f..1f2d13b087 100644 --- a/registry/polaris/listener.go +++ b/registry/polaris/listener.go @@ -21,22 +21,16 @@ import ( "bytes" "net/url" "strconv" -) -import ( gxchan "github.com/dubbogo/gost/container/chan" - perrors "github.com/pkg/errors" - - "github.com/polarismesh/polaris-go/pkg/model" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/registry" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "github.com/polarismesh/polaris-go/pkg/model" ) type polarisListener struct { diff --git a/registry/polaris/registry.go b/registry/polaris/registry.go index eed59fb061..afd67ff1a1 100644 --- a/registry/polaris/registry.go +++ b/registry/polaris/registry.go @@ -22,24 +22,18 @@ import ( "strconv" "sync" "time" -) - -import ( - perrors "github.com/pkg/errors" - - "github.com/polarismesh/polaris-go/api" - "github.com/polarismesh/polaris-go/pkg/model" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" "dubbo.apache.org/dubbo-go/v3/remoting/polaris" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "github.com/polarismesh/polaris-go/api" + "github.com/polarismesh/polaris-go/pkg/model" ) var localIP = "" diff --git a/registry/polaris/service_discovery.go b/registry/polaris/service_discovery.go index 5f0b315ee7..9cba429d25 100644 --- a/registry/polaris/service_discovery.go +++ b/registry/polaris/service_discovery.go @@ -23,26 +23,21 @@ import ( "net/url" "sync" "time" -) -import ( gxset "github.com/dubbogo/gost/container/set" - gxpage "github.com/dubbogo/gost/hash/page" - perrors "github.com/pkg/errors" - - "github.com/polarismesh/polaris-go/api" - "github.com/polarismesh/polaris-go/pkg/model" -) + gxpage "github.com/dubbogo/gost/hash/page" -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" "dubbo.apache.org/dubbo-go/v3/remoting/polaris" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "github.com/polarismesh/polaris-go/api" + "github.com/polarismesh/polaris-go/pkg/model" ) // newPolarisServiceDiscovery will create new service discovery instance diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go index dad12df203..5e9565df9e 100644 --- a/registry/protocol/protocol.go +++ b/registry/protocol/protocol.go @@ -22,25 +22,22 @@ import ( "strings" "sync" "time" -) -import ( gxset "github.com/dubbogo/gost/container/set" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/config_center" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + _ "dubbo.apache.org/dubbo-go/v3/config_center/configurator" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper" "dubbo.apache.org/dubbo-go/v3/registry" + _ "dubbo.apache.org/dubbo-go/v3/registry/directory" "dubbo.apache.org/dubbo-go/v3/remoting" ) diff --git a/registry/service_instance.go b/registry/service_instance.go index dfb7676c90..f0296c040c 100644 --- a/registry/service_instance.go +++ b/registry/service_instance.go @@ -20,16 +20,11 @@ package registry import ( "encoding/json" "strconv" -) -import ( - gxsort "github.com/dubbogo/gost/sort" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" + gxsort "github.com/dubbogo/gost/sort" ) // ServiceInstance is the interface which is used for service registration and discovery. diff --git a/registry/service_instances_changed_listener.go b/registry/service_instances_changed_listener.go index 6b2704ac8b..4c344c8238 100644 --- a/registry/service_instances_changed_listener.go +++ b/registry/service_instances_changed_listener.go @@ -19,14 +19,9 @@ package registry import ( "reflect" -) -import ( gxset "github.com/dubbogo/gost/container/set" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/observer" + "github.com/dubbogo/gost/gof/observer" ) // ServiceInstancesChangedListener is the interface of the Service Discovery Changed Event Listener diff --git a/registry/servicediscovery/service_discovery_registry.go b/registry/servicediscovery/service_discovery_registry.go index 70716e9d50..5ebccf3a53 100644 --- a/registry/servicediscovery/service_discovery_registry.go +++ b/registry/servicediscovery/service_discovery_registry.go @@ -21,27 +21,21 @@ import ( "bytes" "strings" "sync" -) -import ( gxset "github.com/dubbogo/gost/container/set" - perrors "github.com/pkg/errors" - - "go.uber.org/atomic" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/metadata/mapping" "dubbo.apache.org/dubbo-go/v3/metadata/service" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/registry/event" "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery/synthesizer" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "go.uber.org/atomic" ) func init() { diff --git a/registry/xds/registry.go b/registry/xds/registry.go index b3f71b04f6..96f57193ed 100644 --- a/registry/xds/registry.go +++ b/registry/xds/registry.go @@ -22,19 +22,15 @@ import ( "os" "strconv" "strings" -) - -import ( - perrors "github.com/pkg/errors" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting/xds" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + common2 "dubbo.apache.org/dubbo-go/v3/remoting/xds/common" ) diff --git a/registry/zookeeper/listener.go b/registry/zookeeper/listener.go index 51a4346872..10cf80ab9b 100644 --- a/registry/zookeeper/listener.go +++ b/registry/zookeeper/listener.go @@ -20,22 +20,17 @@ package zookeeper import ( "strings" "sync" -) -import ( gxchan "github.com/dubbogo/gost/container/chan" gxzookeeper "github.com/dubbogo/gost/database/kv/zk" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) // RegistryDataListener contains all URL information subscribed by zookeeper registry diff --git a/registry/zookeeper/registry.go b/registry/zookeeper/registry.go index 109b33e00f..d7c2786dd7 100644 --- a/registry/zookeeper/registry.go +++ b/registry/zookeeper/registry.go @@ -23,23 +23,18 @@ import ( "path" "sync" "time" -) -import ( "github.com/dubbogo/go-zookeeper/zk" gxzookeeper "github.com/dubbogo/gost/database/kv/zk" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting/zookeeper" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) func init() { diff --git a/registry/zookeeper/service_discovery.go b/registry/zookeeper/service_discovery.go index fc9466f9bd..9841c2208d 100644 --- a/registry/zookeeper/service_discovery.go +++ b/registry/zookeeper/service_discovery.go @@ -22,23 +22,20 @@ import ( "strconv" "strings" "sync" -) -import ( gxset "github.com/dubbogo/gost/container/set" + gxzookeeper "github.com/dubbogo/gost/database/kv/zk" - gxpage "github.com/dubbogo/gost/hash/page" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" "dubbo.apache.org/dubbo-go/v3/remoting/zookeeper" "dubbo.apache.org/dubbo-go/v3/remoting/zookeeper/curator_discovery" + gxpage "github.com/dubbogo/gost/hash/page" + "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/registry/zookeeper/service_discovery_test.go b/registry/zookeeper/service_discovery_test.go index e0b423c797..477fa5eefe 100644 --- a/registry/zookeeper/service_discovery_test.go +++ b/registry/zookeeper/service_discovery_test.go @@ -37,7 +37,7 @@ package zookeeper // "dubbo.apache.org/dubbo-go/v3/common" // "dubbo.apache.org/dubbo-go/v3/common/constant" // "dubbo.apache.org/dubbo-go/v3/common/extension" -// "dubbo.apache.org/dubbo-go/v3/common/observer" +// "github.com/dubbogo/gost/gof/observer" // "dubbo.apache.org/dubbo-go/v3/common/observer/dispatcher" // "dubbo.apache.org/dubbo-go/v3/config" // "dubbo.apache.org/dubbo-go/v3/metadata/mapping" diff --git a/remoting/etcdv3/client.go b/remoting/etcdv3/client.go index bc6e5e469c..eb164c84b7 100644 --- a/remoting/etcdv3/client.go +++ b/remoting/etcdv3/client.go @@ -20,13 +20,10 @@ package etcdv3 import ( gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" + "github.com/dubbogo/gost/log/logger" perrors "github.com/pkg/errors" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" -) - // ValidateClient validates client and sets options func ValidateClient(container clientFacade, opts ...gxetcd.Option) error { options := &gxetcd.Options{} diff --git a/remoting/etcdv3/facade.go b/remoting/etcdv3/facade.go index 7cdabafba9..5c87d72ffa 100644 --- a/remoting/etcdv3/facade.go +++ b/remoting/etcdv3/facade.go @@ -20,15 +20,10 @@ package etcdv3 import ( "sync" "time" -) -import ( - gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" + gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" + "github.com/dubbogo/gost/log/logger" ) type clientFacade interface { diff --git a/remoting/etcdv3/listener.go b/remoting/etcdv3/listener.go index 6cd677e777..b0030137c7 100644 --- a/remoting/etcdv3/listener.go +++ b/remoting/etcdv3/listener.go @@ -20,21 +20,15 @@ package etcdv3 import ( "sync" "time" -) -import ( gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" perrors "github.com/pkg/errors" - "go.etcd.io/etcd/api/v3/mvccpb" - clientv3 "go.etcd.io/etcd/client/v3" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + clientv3 "go.etcd.io/etcd/client/v3" ) // nolint diff --git a/remoting/exchange.go b/remoting/exchange.go index 6414d0842c..05654cdd5e 100644 --- a/remoting/exchange.go +++ b/remoting/exchange.go @@ -21,15 +21,10 @@ import ( "fmt" "sync" "time" -) -import ( - "go.uber.org/atomic" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" + "go.uber.org/atomic" ) var ( diff --git a/remoting/exchange_client.go b/remoting/exchange_client.go index 464437c4d7..839b078bec 100644 --- a/remoting/exchange_client.go +++ b/remoting/exchange_client.go @@ -20,16 +20,11 @@ package remoting import ( "errors" "time" -) -import ( - uatomic "go.uber.org/atomic" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" + "github.com/dubbogo/gost/log/logger" + uatomic "go.uber.org/atomic" ) // Client is the interface that wraps SetExchangeClient、 Connect、Close、Request and diff --git a/remoting/getty/getty_client.go b/remoting/getty/getty_client.go index 4594377863..8c3cb940ed 100644 --- a/remoting/getty/getty_client.go +++ b/remoting/getty/getty_client.go @@ -21,27 +21,21 @@ import ( "math/rand" "sync" "time" -) -import ( - "github.com/apache/dubbo-getty" + getty "github.com/apache/dubbo-getty" gxsync "github.com/dubbogo/gost/sync" - gxtime "github.com/dubbogo/gost/time" - - perrors "github.com/pkg/errors" - - "go.uber.org/atomic" - "gopkg.in/yaml.v2" -) + gxtime "github.com/dubbogo/gost/time" -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "go.uber.org/atomic" + "gopkg.in/yaml.v2" ) var ( diff --git a/remoting/getty/getty_client_test.go b/remoting/getty/getty_client_test.go index 3d4216b403..d17f49091c 100644 --- a/remoting/getty/getty_client_test.go +++ b/remoting/getty/getty_client_test.go @@ -24,23 +24,18 @@ import ( "sync" "testing" "time" -) -import ( hessian "github.com/apache/dubbo-go-hessian2" + "dubbo.apache.org/dubbo-go/v3/common" perrors "github.com/pkg/errors" - "github.com/stretchr/testify/assert" -) -import ( - "dubbo.apache.org/dubbo-go/v3/common" . "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" + "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" "dubbo.apache.org/dubbo-go/v3/remoting" ) diff --git a/remoting/getty/getty_server.go b/remoting/getty/getty_server.go index f63694164e..b08a4ff043 100644 --- a/remoting/getty/getty_server.go +++ b/remoting/getty/getty_server.go @@ -21,26 +21,20 @@ import ( "crypto/tls" "fmt" "net" -) -import ( - "github.com/apache/dubbo-getty" + getty "github.com/apache/dubbo-getty" gxsync "github.com/dubbogo/gost/sync" - perrors "github.com/pkg/errors" - - "gopkg.in/yaml.v2" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "gopkg.in/yaml.v2" ) var ( diff --git a/remoting/getty/listener.go b/remoting/getty/listener.go index 89fc961c29..600736ba59 100644 --- a/remoting/getty/listener.go +++ b/remoting/getty/listener.go @@ -21,23 +21,18 @@ import ( "sync" "sync/atomic" "time" -) -import ( - "github.com/apache/dubbo-getty" + getty "github.com/apache/dubbo-getty" hessian "github.com/apache/dubbo-go-hessian2" gxtime "github.com/dubbogo/gost/time" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) const ( diff --git a/remoting/getty/pool.go b/remoting/getty/pool.go index c7c037d3ec..074ffb5cd3 100644 --- a/remoting/getty/pool.go +++ b/remoting/getty/pool.go @@ -25,17 +25,12 @@ import ( "sync" "sync/atomic" "time" -) -import ( - "github.com/apache/dubbo-getty" + getty "github.com/apache/dubbo-getty" - perrors "github.com/pkg/errors" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) type gettyRPCClient struct { diff --git a/remoting/getty/readwriter.go b/remoting/getty/readwriter.go index b3956e171a..878e37597d 100644 --- a/remoting/getty/readwriter.go +++ b/remoting/getty/readwriter.go @@ -19,18 +19,13 @@ package getty import ( "reflect" -) -import ( - "github.com/apache/dubbo-getty" + getty "github.com/apache/dubbo-getty" - perrors "github.com/pkg/errors" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) // RpcClientPackageHandler Read data from server and Write data to server diff --git a/remoting/getty/readwriter_test.go b/remoting/getty/readwriter_test.go index 48e4b3f76e..c8320d0d7b 100644 --- a/remoting/getty/readwriter_test.go +++ b/remoting/getty/readwriter_test.go @@ -22,22 +22,16 @@ import ( "reflect" "testing" "time" -) - -import ( - hessian "github.com/apache/dubbo-go-hessian2" - - "github.com/stretchr/testify/assert" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" + "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" "dubbo.apache.org/dubbo-go/v3/remoting" + hessian "github.com/apache/dubbo-go-hessian2" + "github.com/stretchr/testify/assert" ) func TestTCPPackageHandle(t *testing.T) { diff --git a/remoting/nacos/builder.go b/remoting/nacos/builder.go index 8f1f0b84e8..eba86cdeff 100644 --- a/remoting/nacos/builder.go +++ b/remoting/nacos/builder.go @@ -22,21 +22,16 @@ import ( "strconv" "strings" "time" -) -import ( nacosClient "github.com/dubbogo/gost/database/kv/nacos" nacosConstant "github.com/nacos-group/nacos-sdk-go/common/constant" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/config" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) // NewNacosConfigClientByUrl read the config from url and build an instance diff --git a/remoting/xds/client.go b/remoting/xds/client.go index 3cdffc10d7..322350abfc 100644 --- a/remoting/xds/client.go +++ b/remoting/xds/client.go @@ -21,17 +21,13 @@ import ( "errors" "sync" "time" -) - -import ( - perrors "github.com/pkg/errors" -) -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/registry" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + xdsCommon "dubbo.apache.org/dubbo-go/v3/remoting/xds/common" "dubbo.apache.org/dubbo-go/v3/remoting/xds/ewatcher" "dubbo.apache.org/dubbo-go/v3/remoting/xds/mapping" diff --git a/remoting/xds/ewatcher/ewatcher.go b/remoting/xds/ewatcher/ewatcher.go index 304c7daae6..9795e61185 100644 --- a/remoting/xds/ewatcher/ewatcher.go +++ b/remoting/xds/ewatcher/ewatcher.go @@ -21,14 +21,13 @@ import ( "fmt" "strconv" "sync" -) -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + xdsCommon "dubbo.apache.org/dubbo-go/v3/remoting/xds/common" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" ) diff --git a/remoting/xds/mapping/handler.go b/remoting/xds/mapping/handler.go index 36489a91e5..64abf22528 100644 --- a/remoting/xds/mapping/handler.go +++ b/remoting/xds/mapping/handler.go @@ -24,18 +24,13 @@ import ( "net/http" "sync" "time" -) -import ( structpb "github.com/golang/protobuf/ptypes/struct" - perrors "github.com/pkg/errors" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/remoting/xds/common" "dubbo.apache.org/dubbo-go/v3/xds/client" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) const ( diff --git a/remoting/zookeeper/client.go b/remoting/zookeeper/client.go index a12560b214..568d3961a7 100644 --- a/remoting/zookeeper/client.go +++ b/remoting/zookeeper/client.go @@ -19,17 +19,12 @@ package zookeeper import ( "strings" -) -import ( gxzookeeper "github.com/dubbogo/gost/database/kv/zk" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) const ( diff --git a/remoting/zookeeper/curator_discovery/service_discovery.go b/remoting/zookeeper/curator_discovery/service_discovery.go index ab9c475433..64c15b1051 100644 --- a/remoting/zookeeper/curator_discovery/service_discovery.go +++ b/remoting/zookeeper/curator_discovery/service_discovery.go @@ -22,21 +22,16 @@ import ( "path" "strings" "sync" -) -import ( "github.com/dubbogo/go-zookeeper/zk" gxzookeeper "github.com/dubbogo/gost/database/kv/zk" - perrors "github.com/pkg/errors" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/remoting" "dubbo.apache.org/dubbo-go/v3/remoting/zookeeper" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) // Entry contain a service instance diff --git a/remoting/zookeeper/facade.go b/remoting/zookeeper/facade.go index f9a4d59521..7e857cbc97 100644 --- a/remoting/zookeeper/facade.go +++ b/remoting/zookeeper/facade.go @@ -20,15 +20,10 @@ package zookeeper import ( "sync" "time" -) -import ( - gxzookeeper "github.com/dubbogo/gost/database/kv/zk" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/logger" + gxzookeeper "github.com/dubbogo/gost/database/kv/zk" + "github.com/dubbogo/gost/log/logger" ) type ZkClientFacade interface { diff --git a/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go index 15cc14b580..c277a11cef 100644 --- a/remoting/zookeeper/listener.go +++ b/remoting/zookeeper/listener.go @@ -22,23 +22,18 @@ import ( "strings" "sync" "time" -) -import ( "github.com/dubbogo/go-zookeeper/zk" gxzookeeper "github.com/dubbogo/gost/database/kv/zk" perrors "github.com/pkg/errors" - uatomic "go.uber.org/atomic" -) - -import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/remoting" + "github.com/dubbogo/gost/log/logger" + uatomic "go.uber.org/atomic" ) var defaultTTL = 10 * time.Minute diff --git a/xds/balancer/cdsbalancer/cdsbalancer.go b/xds/balancer/cdsbalancer/cdsbalancer.go index 3907a795ed..cd4dbab41b 100644 --- a/xds/balancer/cdsbalancer/cdsbalancer.go +++ b/xds/balancer/cdsbalancer/cdsbalancer.go @@ -28,32 +28,26 @@ import ( "encoding/json" "errors" "fmt" -) -import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/tls/certprovider" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/serviceconfig" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/balancer/clusterresolver" "dubbo.apache.org/dubbo-go/v3/xds/balancer/ringhash" "dubbo.apache.org/dubbo-go/v3/xds/client" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/buffer" + dubboLogger "github.com/dubbogo/gost/log/logger" + xdsinternal "dubbo.apache.org/dubbo-go/v3/xds/utils/credentials/xds" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" + internalserviceconfig "dubbo.apache.org/dubbo-go/v3/xds/utils/serviceconfig" ) diff --git a/xds/balancer/clusterimpl/clusterimpl.go b/xds/balancer/clusterimpl/clusterimpl.go index c18c9a4120..6f576715bc 100644 --- a/xds/balancer/clusterimpl/clusterimpl.go +++ b/xds/balancer/clusterimpl/clusterimpl.go @@ -33,20 +33,14 @@ import ( "fmt" "sync" "sync/atomic" -) -import ( "google.golang.org/grpc/balancer" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/serviceconfig" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" + dubboLogger "github.com/dubbogo/gost/log/logger" + internal "dubbo.apache.org/dubbo-go/v3/xds" "dubbo.apache.org/dubbo-go/v3/xds/balancer/loadstore" "dubbo.apache.org/dubbo-go/v3/xds/client" diff --git a/xds/balancer/clusterimpl/picker.go b/xds/balancer/clusterimpl/picker.go index 95a1f7d8af..fd710f923d 100644 --- a/xds/balancer/clusterimpl/picker.go +++ b/xds/balancer/clusterimpl/picker.go @@ -33,13 +33,11 @@ import ( "google.golang.org/grpc/connectivity" "google.golang.org/grpc/status" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client" "dubbo.apache.org/dubbo-go/v3/xds/client/load" "dubbo.apache.org/dubbo-go/v3/xds/utils/wrr" + dubboLogger "github.com/dubbogo/gost/log/logger" ) // NewRandomWRR is used when calculating drops. It's exported so that tests can diff --git a/xds/balancer/clustermanager/balancerstateaggregator.go b/xds/balancer/clustermanager/balancerstateaggregator.go index b735cc35bf..891a55a8db 100644 --- a/xds/balancer/clustermanager/balancerstateaggregator.go +++ b/xds/balancer/clustermanager/balancerstateaggregator.go @@ -26,17 +26,12 @@ package clustermanager import ( "fmt" "sync" -) -import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" - "google.golang.org/grpc/connectivity" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" + dubboLogger "github.com/dubbogo/gost/log/logger" ) type subBalancerState struct { diff --git a/xds/balancer/clustermanager/clustermanager.go b/xds/balancer/clustermanager/clustermanager.go index 989da2c18d..5fd556b775 100644 --- a/xds/balancer/clustermanager/clustermanager.go +++ b/xds/balancer/clustermanager/clustermanager.go @@ -27,21 +27,15 @@ package clustermanager import ( "encoding/json" "fmt" -) -import ( "google.golang.org/grpc/balancer" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/serviceconfig" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/utils/balancergroup" "dubbo.apache.org/dubbo-go/v3/xds/utils/hierarchy" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" + dubboLogger "github.com/dubbogo/gost/log/logger" ) const balancerName = "xds_cluster_manager_experimental" diff --git a/xds/balancer/clusterresolver/clusterresolver.go b/xds/balancer/clusterresolver/clusterresolver.go index ca6ee604e7..846fe772ca 100644 --- a/xds/balancer/clusterresolver/clusterresolver.go +++ b/xds/balancer/clusterresolver/clusterresolver.go @@ -28,29 +28,21 @@ import ( "encoding/json" "errors" "fmt" -) -import ( "google.golang.org/grpc/attributes" - "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/serviceconfig" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/balancer/priority" "dubbo.apache.org/dubbo-go/v3/xds/client" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/buffer" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" + dubboLogger "github.com/dubbogo/gost/log/logger" ) // Name is the name of the cluster_resolver balancer. diff --git a/xds/balancer/clusterresolver/configbuilder.go b/xds/balancer/clusterresolver/configbuilder.go index 9c3985bbee..cb5747cd33 100644 --- a/xds/balancer/clusterresolver/configbuilder.go +++ b/xds/balancer/clusterresolver/configbuilder.go @@ -27,23 +27,19 @@ import ( "encoding/json" "fmt" "sort" -) -import ( "google.golang.org/grpc/balancer/roundrobin" "google.golang.org/grpc/balancer/weightedroundrobin" "google.golang.org/grpc/balancer/weightedtarget" - "google.golang.org/grpc/resolver" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/balancer/clusterimpl" "dubbo.apache.org/dubbo-go/v3/xds/balancer/priority" "dubbo.apache.org/dubbo-go/v3/xds/balancer/ringhash" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/hierarchy" + dubboLogger "github.com/dubbogo/gost/log/logger" + internalserviceconfig "dubbo.apache.org/dubbo-go/v3/xds/utils/serviceconfig" ) diff --git a/xds/balancer/orca/orca.go b/xds/balancer/orca/orca.go index 4ce9ec8454..b4e7499f1f 100644 --- a/xds/balancer/orca/orca.go +++ b/xds/balancer/orca/orca.go @@ -29,12 +29,9 @@ import ( "github.com/golang/protobuf/proto" - "google.golang.org/grpc/metadata" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/utils/balancerload" + "github.com/dubbogo/gost/log/logger" + "google.golang.org/grpc/metadata" ) const mdKey = "X-Endpoint-Load-Metrics-Bin" diff --git a/xds/balancer/priority/balancer.go b/xds/balancer/priority/balancer.go index 76bacd4c74..48c6da96ae 100644 --- a/xds/balancer/priority/balancer.go +++ b/xds/balancer/priority/balancer.go @@ -33,23 +33,17 @@ import ( "fmt" "sync" "time" -) -import ( "google.golang.org/grpc/balancer" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/serviceconfig" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/utils/balancergroup" "dubbo.apache.org/dubbo-go/v3/xds/utils/buffer" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" "dubbo.apache.org/dubbo-go/v3/xds/utils/hierarchy" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" + dubboLogger "github.com/dubbogo/gost/log/logger" ) // Name is the name of the priority balancer. diff --git a/xds/balancer/ringhash/picker.go b/xds/balancer/ringhash/picker.go index 1d62e5a13e..7fdc806735 100644 --- a/xds/balancer/ringhash/picker.go +++ b/xds/balancer/ringhash/picker.go @@ -25,20 +25,13 @@ package ringhash import ( "fmt" -) -import ( "google.golang.org/grpc/balancer" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/status" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" + dubboLogger "github.com/dubbogo/gost/log/logger" ) type picker struct { diff --git a/xds/balancer/ringhash/ringhash.go b/xds/balancer/ringhash/ringhash.go index 6ee145d097..a9a3b74ed5 100644 --- a/xds/balancer/ringhash/ringhash.go +++ b/xds/balancer/ringhash/ringhash.go @@ -29,23 +29,16 @@ import ( "errors" "fmt" "sync" -) -import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" "google.golang.org/grpc/balancer/weightedroundrobin" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/serviceconfig" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" + dubboLogger "github.com/dubbogo/gost/log/logger" ) // Name is the name of the ring_hash balancer. diff --git a/xds/client/authority.go b/xds/client/authority.go index e15580f6e2..ff16bf0ea3 100644 --- a/xds/client/authority.go +++ b/xds/client/authority.go @@ -26,18 +26,14 @@ package client import ( "errors" "fmt" -) -import ( _struct "github.com/golang/protobuf/ptypes/struct" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client/bootstrap" "dubbo.apache.org/dubbo-go/v3/xds/client/load" "dubbo.apache.org/dubbo-go/v3/xds/client/pubsub" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" + dubboLogger "github.com/dubbogo/gost/log/logger" ) const federationScheme = "xdstp" diff --git a/xds/client/bootstrap/bootstrap.go b/xds/client/bootstrap/bootstrap.go index ebb76ba853..c58ca70c06 100644 --- a/xds/client/bootstrap/bootstrap.go +++ b/xds/client/bootstrap/bootstrap.go @@ -31,24 +31,20 @@ import ( "fmt" "io/ioutil" "strings" -) -import ( v2corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" - v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" + v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" - "google.golang.org/grpc" "google.golang.org/grpc/credentials/google" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/tls/certprovider" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" + dubboLogger "github.com/dubbogo/gost/log/logger" + internal2 "dubbo.apache.org/dubbo-go/v3/xds/internal" "dubbo.apache.org/dubbo-go/v3/xds/utils/envconfig" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" diff --git a/xds/client/client.go b/xds/client/client.go index f1de41027f..4d5ec3e730 100644 --- a/xds/client/client.go +++ b/xds/client/client.go @@ -29,17 +29,14 @@ import ( "fmt" "sync" "time" -) -import ( _struct "github.com/golang/protobuf/ptypes/struct" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client/bootstrap" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" + dubboLogger "github.com/dubbogo/gost/log/logger" + cache "dubbo.apache.org/dubbo-go/v3/xds/utils/xds_cache" ) diff --git a/xds/client/controller.go b/xds/client/controller.go index 3af5ae408b..c6a6a544bb 100644 --- a/xds/client/controller.go +++ b/xds/client/controller.go @@ -25,15 +25,13 @@ package client import ( _struct "github.com/golang/protobuf/ptypes/struct" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client/bootstrap" "dubbo.apache.org/dubbo-go/v3/xds/client/controller" "dubbo.apache.org/dubbo-go/v3/xds/client/load" "dubbo.apache.org/dubbo-go/v3/xds/client/pubsub" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" + dubboLogger "github.com/dubbogo/gost/log/logger" ) type controllerInterface interface { diff --git a/xds/client/controller/controller.go b/xds/client/controller/controller.go index 6f45b94a3d..904066e307 100644 --- a/xds/client/controller/controller.go +++ b/xds/client/controller/controller.go @@ -35,25 +35,20 @@ import ( "fmt" "sync" "time" -) -import ( v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" _struct "github.com/golang/protobuf/ptypes/struct" - "google.golang.org/grpc" "google.golang.org/grpc/keepalive" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client/bootstrap" "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version" "dubbo.apache.org/dubbo-go/v3/xds/client/pubsub" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/backoff" "dubbo.apache.org/dubbo-go/v3/xds/utils/buffer" + dubboLogger "github.com/dubbogo/gost/log/logger" ) // Controller manages the connection and stream to the control plane. diff --git a/xds/client/controller/version/v2/client.go b/xds/client/controller/version/v2/client.go index db17af0554..4f2b6efe0d 100644 --- a/xds/client/controller/version/v2/client.go +++ b/xds/client/controller/version/v2/client.go @@ -27,28 +27,25 @@ package v2 import ( "context" "fmt" -) -import ( v2xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" v2corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" - v2adsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2" + v2adsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2" "github.com/golang/protobuf/proto" + _struct "github.com/golang/protobuf/ptypes/struct" statuspb "google.golang.org/genproto/googleapis/rpc/status" - "google.golang.org/grpc" "google.golang.org/grpc/codes" - "google.golang.org/protobuf/types/known/anypb" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" + dubboLogger "github.com/dubbogo/gost/log/logger" + controllerversion "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" + resourceversion "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" ) diff --git a/xds/client/controller/version/v3/client.go b/xds/client/controller/version/v3/client.go index b20a409059..85acc58c6c 100644 --- a/xds/client/controller/version/v3/client.go +++ b/xds/client/controller/version/v3/client.go @@ -27,28 +27,25 @@ package v3 import ( "context" "fmt" -) -import ( v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" v3adsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - v3discoverypb "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" + v3discoverypb "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" "github.com/golang/protobuf/proto" + _struct "github.com/golang/protobuf/ptypes/struct" statuspb "google.golang.org/genproto/googleapis/rpc/status" - "google.golang.org/grpc" "google.golang.org/grpc/codes" - "google.golang.org/protobuf/types/known/anypb" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" + dubboLogger "github.com/dubbogo/gost/log/logger" + controllerversion "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" + resourceversion "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" ) diff --git a/xds/client/controller/version/version.go b/xds/client/controller/version/version.go index 43262668a7..0913cac5fe 100644 --- a/xds/client/controller/version/version.go +++ b/xds/client/controller/version/version.go @@ -27,22 +27,17 @@ package version import ( "context" "time" -) -import ( "github.com/golang/protobuf/proto" - _struct "github.com/golang/protobuf/ptypes/struct" + _struct "github.com/golang/protobuf/ptypes/struct" "google.golang.org/grpc" - "google.golang.org/protobuf/types/known/anypb" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client/load" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" + dubboLogger "github.com/dubbogo/gost/log/logger" ) var ( diff --git a/xds/client/pubsub/pubsub.go b/xds/client/pubsub/pubsub.go index 70deddc3bf..adba1e22ab 100644 --- a/xds/client/pubsub/pubsub.go +++ b/xds/client/pubsub/pubsub.go @@ -31,13 +31,11 @@ package pubsub import ( "sync" "time" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/buffer" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" + dubboLogger "github.com/dubbogo/gost/log/logger" ) // Pubsub maintains resource watchers and resource updates. diff --git a/xds/client/resource/filter_chain.go b/xds/client/resource/filter_chain.go index afcb7c5021..dce698ea50 100644 --- a/xds/client/resource/filter_chain.go +++ b/xds/client/resource/filter_chain.go @@ -27,23 +27,19 @@ import ( "errors" "fmt" "net" -) -import ( v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" v3httppb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" - v3tlspb "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" + v3tlspb "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" "dubbo.apache.org/dubbo-go/v3/xds/httpfilter" "dubbo.apache.org/dubbo-go/v3/xds/utils/envconfig" "dubbo.apache.org/dubbo-go/v3/xds/utils/resolver" + dubboLogger "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/xds/client/resource/unmarshal.go b/xds/client/resource/unmarshal.go index b643651b51..7b213d2050 100644 --- a/xds/client/resource/unmarshal.go +++ b/xds/client/resource/unmarshal.go @@ -30,14 +30,10 @@ import ( "fmt" "strings" "time" -) -import ( "google.golang.org/protobuf/types/known/anypb" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" + dubboLogger "github.com/dubbogo/gost/log/logger" ) // UnmarshalOptions wraps the input parameters for `UnmarshalXxx` functions. diff --git a/xds/client/resource/unmarshal_cds.go b/xds/client/resource/unmarshal_cds.go index aa909d6087..3e2e22b1fc 100644 --- a/xds/client/resource/unmarshal_cds.go +++ b/xds/client/resource/unmarshal_cds.go @@ -28,25 +28,21 @@ import ( "fmt" "net" "strconv" -) -import ( v3clusterpb "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" + v3aggregateclusterpb "github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/aggregate/v3" - v3tlspb "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" + v3tlspb "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" "github.com/golang/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" "dubbo.apache.org/dubbo-go/v3/xds/utils/envconfig" "dubbo.apache.org/dubbo-go/v3/xds/utils/matcher" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" + dubboLogger "github.com/dubbogo/gost/log/logger" ) // TransportSocket proto message has a `name` field which is expected to be set diff --git a/xds/client/resource/unmarshal_eds.go b/xds/client/resource/unmarshal_eds.go index 23132e9032..6e3ad65aa8 100644 --- a/xds/client/resource/unmarshal_eds.go +++ b/xds/client/resource/unmarshal_eds.go @@ -27,21 +27,16 @@ import ( "fmt" "net" "strconv" -) -import ( v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" v3endpointpb "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" - v3typepb "github.com/envoyproxy/go-control-plane/envoy/type/v3" + v3typepb "github.com/envoyproxy/go-control-plane/envoy/type/v3" "github.com/golang/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" + dubboLogger "github.com/dubbogo/gost/log/logger" ) // UnmarshalEndpoints processes resources received in an EDS response, diff --git a/xds/client/resource/unmarshal_lds.go b/xds/client/resource/unmarshal_lds.go index 011b4593fc..79c0e72061 100644 --- a/xds/client/resource/unmarshal_lds.go +++ b/xds/client/resource/unmarshal_lds.go @@ -27,28 +27,24 @@ import ( "errors" "fmt" "strconv" -) -import ( v1udpatypepb "github.com/cncf/udpa/go/udpa/type/v1" v3cncftypepb "github.com/cncf/xds/go/xds/type/v3" v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" + v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" - v3httppb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" + v3httppb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" - "google.golang.org/protobuf/types/known/anypb" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" "dubbo.apache.org/dubbo-go/v3/xds/httpfilter" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" + dubboLogger "github.com/dubbogo/gost/log/logger" ) // UnmarshalListener processes resources received in an LDS response, validates diff --git a/xds/client/resource/unmarshal_rds.go b/xds/client/resource/unmarshal_rds.go index 3cf346da73..5851ffd037 100644 --- a/xds/client/resource/unmarshal_rds.go +++ b/xds/client/resource/unmarshal_rds.go @@ -28,25 +28,18 @@ import ( "regexp" "strings" "time" -) -import ( v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" v3typepb "github.com/envoyproxy/go-control-plane/envoy/type/v3" - "github.com/golang/protobuf/proto" - "google.golang.org/grpc/codes" - "google.golang.org/protobuf/types/known/anypb" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" "dubbo.apache.org/dubbo-go/v3/xds/clusterspecifier" "dubbo.apache.org/dubbo-go/v3/xds/utils/envconfig" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" + dubboLogger "github.com/dubbogo/gost/log/logger" ) // UnmarshalRouteConfig processes resources received in an RDS response, diff --git a/xds/csds/csds.go b/xds/csds/csds.go index f5172a3975..b3da260722 100644 --- a/xds/csds/csds.go +++ b/xds/csds/csds.go @@ -31,32 +31,31 @@ package csds import ( "context" "io" -) -import ( v3adminpb "github.com/envoyproxy/go-control-plane/envoy/admin/v3" v2corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" + v3statusgrpc "github.com/envoyproxy/go-control-plane/envoy/service/status/v3" - v3statuspb "github.com/envoyproxy/go-control-plane/envoy/service/status/v3" + "dubbo.apache.org/dubbo-go/v3/xds/client" + "github.com/dubbogo/gost/log/logger" + v3statuspb "github.com/envoyproxy/go-control-plane/envoy/service/status/v3" "github.com/golang/protobuf/proto" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/timestamppb" -) -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" - "dubbo.apache.org/dubbo-go/v3/xds/client" - _ "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version/v2" // Register v2 xds_client. - _ "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version/v3" // Register v3 xds_client. + _ "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version/v2" + + // Register v2 xds_client. + _ "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version/v3" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" ) +// Register v3 xds_client. + var ( newXDSClient = func() client.XDSClient { c, err := client.New() diff --git a/xds/resolver/watch_service.go b/xds/resolver/watch_service.go index 7b275f4c2b..fdf82c0a3d 100644 --- a/xds/resolver/watch_service.go +++ b/xds/resolver/watch_service.go @@ -27,14 +27,12 @@ import ( "fmt" "sync" "time" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/clusterspecifier" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" + dubboLogger "github.com/dubbogo/gost/log/logger" ) // serviceUpdate contains information received from the LDS/RDS responses which diff --git a/xds/resolver/xds_resolver.go b/xds/resolver/xds_resolver.go index 9457c62129..79ae9a9ee3 100644 --- a/xds/resolver/xds_resolver.go +++ b/xds/resolver/xds_resolver.go @@ -29,21 +29,17 @@ import ( "errors" "fmt" "strings" -) -import ( "google.golang.org/grpc/credentials" - "google.golang.org/grpc/resolver" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client" "dubbo.apache.org/dubbo-go/v3/xds/client/bootstrap" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" + dubboLogger "github.com/dubbogo/gost/log/logger" + iresolver "dubbo.apache.org/dubbo-go/v3/xds/utils/resolver" ) diff --git a/xds/server/listener_wrapper.go b/xds/server/listener_wrapper.go index cf3d12f92b..4437db72a7 100644 --- a/xds/server/listener_wrapper.go +++ b/xds/server/listener_wrapper.go @@ -33,20 +33,15 @@ import ( "sync/atomic" "time" "unsafe" -) -import ( "google.golang.org/grpc/backoff" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/grpclog" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" "dubbo.apache.org/dubbo-go/v3/xds/client/bootstrap" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" + dubboLogger "github.com/dubbogo/gost/log/logger" + internalbackoff "dubbo.apache.org/dubbo-go/v3/xds/utils/backoff" "dubbo.apache.org/dubbo-go/v3/xds/utils/envconfig" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" diff --git a/xds/utils/balancergroup/balancergroup.go b/xds/utils/balancergroup/balancergroup.go index 3f11e9b4f1..39af4c649a 100644 --- a/xds/utils/balancergroup/balancergroup.go +++ b/xds/utils/balancergroup/balancergroup.go @@ -29,18 +29,13 @@ import ( "fmt" "sync" "time" -) -import ( "google.golang.org/grpc/balancer" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/resolver" -) -import ( - dubboLogger "dubbo.apache.org/dubbo-go/v3/common/logger" + dubboLogger "github.com/dubbogo/gost/log/logger" + cache "dubbo.apache.org/dubbo-go/v3/xds/utils/xds_cache" ) diff --git a/xds/utils/grpclog/grpclog.go b/xds/utils/grpclog/grpclog.go index aa7a2d37f8..3d36045e98 100644 --- a/xds/utils/grpclog/grpclog.go +++ b/xds/utils/grpclog/grpclog.go @@ -26,10 +26,8 @@ package grpclog import ( "os" -) -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" + "github.com/dubbogo/gost/log/logger" ) // Logger is the logger used for the non-depth log functions. diff --git a/xds/utils/serviceconfig/serviceconfig.go b/xds/utils/serviceconfig/serviceconfig.go index a9115f5710..bcce6c39dc 100644 --- a/xds/utils/serviceconfig/serviceconfig.go +++ b/xds/utils/serviceconfig/serviceconfig.go @@ -28,20 +28,14 @@ import ( "encoding/json" "fmt" "time" -) -import ( "google.golang.org/grpc/balancer" - "google.golang.org/grpc/codes" + "github.com/dubbogo/gost/log/logger" externalserviceconfig "google.golang.org/grpc/serviceconfig" ) -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" -) - // BalancerConfig wraps the name and config associated with one load balancing // policy. It corresponds to a single entry of the loadBalancingConfig field // from ServiceConfig. From c156e39e71cbe2f2e0cf4fd4481f9c5a0438641d Mon Sep 17 00:00:00 2001 From: Leospard <694963063@qq.com> Date: Fri, 1 Jul 2022 18:24:11 +0800 Subject: [PATCH 5/8] reduce common dir --- common/file/suffix.go | 28 -- common/logger/file_log.yml | 36 --- common/logger/logger.go | 172 ----------- common/logger/logging.go | 68 ----- common/observer/event.go | 68 ----- common/observer/event_listener.go | 50 ---- common/proxy/proxy.go | 277 ------------------ common/proxy/proxy_factory.go | 32 -- common/proxy/proxy_factory/default.go | 168 ----------- common/proxy/proxy_factory/default_test.go | 60 ---- common/proxy/proxy_factory/pass_through.go | 128 -------- .../proxy/proxy_factory/pass_through_test.go | 61 ---- common/proxy/proxy_factory/utils.go | 57 ---- common/proxy/proxy_test.go | 159 ---------- common/yaml/testdata/config.yml | 7 - common/yaml/yaml.go | 61 ---- common/yaml/yaml_test.go | 70 ----- 17 files changed, 1502 deletions(-) delete mode 100644 common/file/suffix.go delete mode 100644 common/logger/file_log.yml delete mode 100644 common/logger/logger.go delete mode 100644 common/logger/logging.go delete mode 100644 common/observer/event.go delete mode 100644 common/observer/event_listener.go delete mode 100644 common/proxy/proxy.go delete mode 100644 common/proxy/proxy_factory.go delete mode 100644 common/proxy/proxy_factory/default.go delete mode 100644 common/proxy/proxy_factory/default_test.go delete mode 100644 common/proxy/proxy_factory/pass_through.go delete mode 100644 common/proxy/proxy_factory/pass_through_test.go delete mode 100644 common/proxy/proxy_factory/utils.go delete mode 100644 common/proxy/proxy_test.go delete mode 100644 common/yaml/testdata/config.yml delete mode 100644 common/yaml/yaml.go delete mode 100644 common/yaml/yaml_test.go diff --git a/common/file/suffix.go b/common/file/suffix.go deleted file mode 100644 index bd8876c57e..0000000000 --- a/common/file/suffix.go +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package file - -type Suffix string - -const ( - JSON = Suffix("json") - TOML = Suffix("toml") - YAML = Suffix("yaml") - YML = Suffix("yml") - PROPERTIES = Suffix("properties") -) diff --git a/common/logger/file_log.yml b/common/logger/file_log.yml deleted file mode 100644 index 75cc32c7ea..0000000000 --- a/common/logger/file_log.yml +++ /dev/null @@ -1,36 +0,0 @@ -lumberjackConfig: - filename: "logs.log" - maxSize: 1 - maxAge: 3 - maxBackups: 5 - localTime: true - compress: false - -zapConfig: - level: "debug" - development: false - disableCaller: false - disableStacktrace: false - sampling: - encoding: "console" - - # encoder - encoderConfig: - messageKey: "message" - levelKey: "level" - timeKey: "time" - nameKey: "logger" - callerKey: "caller" - stacktraceKey: "stacktrace" - lineEnding: "" - levelEncoder: "capitalColor" - timeEncoder: "iso8601" - durationEncoder: "seconds" - callerEncoder: "short" - nameEncoder: "" - - outputPaths: - - "stderr" - errorOutputPaths: - - "stderr" - initialFields: diff --git a/common/logger/logger.go b/common/logger/logger.go deleted file mode 100644 index 29d0278fab..0000000000 --- a/common/logger/logger.go +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package logger - -import ( - "github.com/apache/dubbo-getty" - - "github.com/natefinch/lumberjack" - - "go.uber.org/zap" - "go.uber.org/zap/zapcore" -) - -var logger Logger - -func init() { - InitLogger(nil) -} - -// nolint -type DubboLogger struct { - Logger - dynamicLevel zap.AtomicLevel -} - -type Config struct { - LumberjackConfig *lumberjack.Logger `yaml:"lumberjack-config"` - ZapConfig *zap.Config `yaml:"zap-config"` - CallerSkip int -} - -// Logger is the interface for Logger types -type Logger interface { - Info(args ...interface{}) - Warn(args ...interface{}) - Error(args ...interface{}) - Debug(args ...interface{}) - Fatal(args ...interface{}) - - Infof(fmt string, args ...interface{}) - Warnf(fmt string, args ...interface{}) - Errorf(fmt string, args ...interface{}) - Debugf(fmt string, args ...interface{}) - Fatalf(fmt string, args ...interface{}) -} - -// InitLogger use for init logger by @conf -func InitLogger(conf *Config) { - var ( - zapLogger *zap.Logger - config = &Config{} - ) - if conf == nil || conf.ZapConfig == nil { - zapLoggerEncoderConfig := zapcore.EncoderConfig{ - TimeKey: "time", - LevelKey: "level", - NameKey: "logger", - CallerKey: "caller", - MessageKey: "message", - StacktraceKey: "stacktrace", - EncodeLevel: zapcore.CapitalColorLevelEncoder, - EncodeTime: zapcore.ISO8601TimeEncoder, - EncodeDuration: zapcore.SecondsDurationEncoder, - EncodeCaller: zapcore.ShortCallerEncoder, - } - config.ZapConfig = &zap.Config{ - Level: zap.NewAtomicLevelAt(zap.InfoLevel), - Development: false, - Encoding: "console", - EncoderConfig: zapLoggerEncoderConfig, - OutputPaths: []string{"stderr"}, - ErrorOutputPaths: []string{"stderr"}, - } - } else { - config.ZapConfig = conf.ZapConfig - } - - if conf != nil { - config.CallerSkip = conf.CallerSkip - } - - if config.CallerSkip == 0 { - config.CallerSkip = 1 - } - - if conf == nil || conf.LumberjackConfig == nil { - zapLogger, _ = config.ZapConfig.Build(zap.AddCaller(), zap.AddCallerSkip(config.CallerSkip)) - } else { - config.LumberjackConfig = conf.LumberjackConfig - zapLogger = initZapLoggerWithSyncer(config) - } - - logger = &DubboLogger{Logger: zapLogger.Sugar(), dynamicLevel: config.ZapConfig.Level} - - // set getty log - getty.SetLogger(logger) -} - -// SetLogger sets logger for dubbo and getty -func SetLogger(log Logger) { - logger = log - getty.SetLogger(logger) -} - -// GetLogger gets the logger -func GetLogger() Logger { - return logger -} - -// SetLoggerLevel use for set logger level -func SetLoggerLevel(level string) bool { - if l, ok := logger.(OpsLogger); ok { - l.SetLoggerLevel(level) - return true - } - return false -} - -// OpsLogger use for the SetLoggerLevel -type OpsLogger interface { - Logger - SetLoggerLevel(level string) -} - -// SetLoggerLevel use for set logger level -func (dl *DubboLogger) SetLoggerLevel(level string) { - l := new(zapcore.Level) - if err := l.Set(level); err == nil { - dl.dynamicLevel.SetLevel(*l) - } -} - -// initZapLoggerWithSyncer init zap Logger with syncer -func initZapLoggerWithSyncer(conf *Config) *zap.Logger { - core := zapcore.NewCore( - conf.getEncoder(), - conf.getLogWriter(), - zap.NewAtomicLevelAt(conf.ZapConfig.Level.Level()), - ) - - return zap.New(core, zap.AddCaller(), zap.AddCallerSkip(conf.CallerSkip)) -} - -// getEncoder get encoder by config, zapcore support json and console encoder -func (c *Config) getEncoder() zapcore.Encoder { - if c.ZapConfig.Encoding == "json" { - return zapcore.NewJSONEncoder(c.ZapConfig.EncoderConfig) - } else if c.ZapConfig.Encoding == "console" { - return zapcore.NewConsoleEncoder(c.ZapConfig.EncoderConfig) - } - return nil -} - -// getLogWriter get Lumberjack writer by LumberjackConfig -func (c *Config) getLogWriter() zapcore.WriteSyncer { - return zapcore.AddSync(c.LumberjackConfig) -} diff --git a/common/logger/logging.go b/common/logger/logging.go deleted file mode 100644 index d114423c3d..0000000000 --- a/common/logger/logging.go +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package logger - -// Info is info level -func Info(args ...interface{}) { - logger.Info(args...) -} - -// Warn is warning level -func Warn(args ...interface{}) { - logger.Warn(args...) -} - -// Error is error level -func Error(args ...interface{}) { - logger.Error(args...) -} - -// Debug is debug level -func Debug(args ...interface{}) { - logger.Debug(args...) -} - -// Infof is format info level -func Infof(fmt string, args ...interface{}) { - logger.Infof(fmt, args...) -} - -// Warnf is format warning level -func Warnf(fmt string, args ...interface{}) { - logger.Warnf(fmt, args...) -} - -// Errorf is format error level -func Errorf(fmt string, args ...interface{}) { - logger.Errorf(fmt, args...) -} - -// Debugf is format debug level -func Debugf(fmt string, args ...interface{}) { - logger.Debugf(fmt, args...) -} - -// Fatal logs a message, then calls os.Exit. -func Fatal(args ...interface{}) { - logger.Fatal(args...) -} - -// Fatalf logs a templated message, then calls os.Exit. -func Fatalf(fmt string, args ...interface{}) { - logger.Fatalf(fmt, args...) -} diff --git a/common/observer/event.go b/common/observer/event.go deleted file mode 100644 index 209a50c78a..0000000000 --- a/common/observer/event.go +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package observer - -import ( - "fmt" - "math/rand" - "time" -) - -func init() { - rand.Seed(time.Now().UnixNano()) -} - -// Event is align with Event interface in Java. -// it's the top abstraction -// Align with 2.7.5 -type Event interface { - fmt.Stringer - GetSource() interface{} - GetTimestamp() time.Time -} - -// BaseEvent is the base implementation of Event -// You should never use it directly -type BaseEvent struct { - Source interface{} - Timestamp time.Time -} - -// GetSource return the source -func (b *BaseEvent) GetSource() interface{} { - return b.Source -} - -// GetTimestamp return the Timestamp when the event is created -func (b *BaseEvent) GetTimestamp() time.Time { - return b.Timestamp -} - -// String return a human readable string representing this event -func (b *BaseEvent) String() string { - return fmt.Sprintf("BaseEvent[source = %#v]", b.Source) -} - -// NewBaseEvent create an BaseEvent instance -// and the Timestamp will be current timestamp -func NewBaseEvent(source interface{}) *BaseEvent { - return &BaseEvent{ - Source: source, - Timestamp: time.Now(), - } -} diff --git a/common/observer/event_listener.go b/common/observer/event_listener.go deleted file mode 100644 index faa8705a42..0000000000 --- a/common/observer/event_listener.go +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package observer - -import ( - "reflect" -) - -import ( - gxsort "github.com/dubbogo/gost/sort" -) - -// EventListener is an new interface used to align with dubbo 2.7.5 -// It contains the Prioritized means that the listener has its priority -// Usually the priority of your custom implementation should be between [100, 9000] -// the number outside the range will be though as system reserve number -// usually implementation should be singleton -type EventListener interface { - gxsort.Prioritizer - // OnEvent handle this event - OnEvent(e Event) error - // GetEventType listen which event type - GetEventType() reflect.Type -} - -// ConditionalEventListener only handle the event which it can handle -type ConditionalEventListener interface { - EventListener - // Accept will make the decision whether it should handle this event - Accept(e Event) bool -} - -type ChangedNotify interface { - Notify(e Event) -} diff --git a/common/proxy/proxy.go b/common/proxy/proxy.go deleted file mode 100644 index ce2ea7cdfb..0000000000 --- a/common/proxy/proxy.go +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package proxy - -import ( - "context" - "errors" - "reflect" - "sync" - - "github.com/apache/dubbo-go-hessian2/java_exception" - - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - - invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation" -) - -// nolint -type Proxy struct { - rpc common.RPCService - invoke protocol.Invoker - callback interface{} - attachments map[string]string - implement ImplementFunc - once sync.Once -} - -type ( - // ProxyOption a function to init Proxy with options - ProxyOption func(p *Proxy) - // ImplementFunc function for proxy impl of RPCService functions - ImplementFunc func(p *Proxy, v common.RPCService) -) - -var typError = reflect.Zero(reflect.TypeOf((*error)(nil)).Elem()).Type() - -// NewProxy create service proxy. -func NewProxy(invoke protocol.Invoker, callback interface{}, attachments map[string]string) *Proxy { - return NewProxyWithOptions(invoke, callback, attachments, - WithProxyImplementFunc(DefaultProxyImplementFunc)) -} - -// NewProxyWithOptions create service proxy with options. -func NewProxyWithOptions(invoke protocol.Invoker, callback interface{}, attachments map[string]string, opts ...ProxyOption) *Proxy { - p := &Proxy{ - invoke: invoke, - callback: callback, - attachments: attachments, - } - for _, opt := range opts { - opt(p) - } - return p -} - -// WithProxyImplementFunc an option function to setup proxy.ImplementFunc -func WithProxyImplementFunc(f ImplementFunc) ProxyOption { - return func(p *Proxy) { - p.implement = f - } -} - -// Implement -// proxy implement -// In consumer, RPCService like: -// type XxxProvider struct { -// Yyy func(ctx context.Context, args []interface{}, rsp *Zzz) error -// } -func (p *Proxy) Implement(v common.RPCService) { - p.once.Do(func() { - p.implement(p, v) - p.rpc = v - }) -} - -// Get gets rpc service instance. -func (p *Proxy) Get() common.RPCService { - return p.rpc -} - -// GetCallback gets callback. -func (p *Proxy) GetCallback() interface{} { - return p.callback -} - -// GetInvoker gets Invoker. -func (p *Proxy) GetInvoker() protocol.Invoker { - return p.invoke -} - -// DefaultProxyImplementFunc the default function for proxy impl -func DefaultProxyImplementFunc(p *Proxy, v common.RPCService) { - // check parameters, incoming interface must be a elem's pointer. - valueOf := reflect.ValueOf(v) - - valueOfElem := valueOf.Elem() - - makeDubboCallProxy := func(methodName string, outs []reflect.Type) func(in []reflect.Value) []reflect.Value { - return func(in []reflect.Value) []reflect.Value { - var ( - err error - inv *invocation_impl.RPCInvocation - inIArr []interface{} - inVArr []reflect.Value - reply reflect.Value - replyEmptyFlag bool - ) - if methodName == "Echo" { - methodName = "$echo" - } - - if len(outs) == 2 { // return (reply, error) - if outs[0].Kind() == reflect.Ptr { - reply = reflect.New(outs[0].Elem()) - } else { - reply = reflect.New(outs[0]) - } - } else { // only return error - replyEmptyFlag = true - } - - start := 0 - end := len(in) - invCtx := context.Background() - // retrieve the context from the first argument if existed - if end > 0 { - if in[0].Type().String() == "context.Context" { - if !in[0].IsNil() { - // the user declared context as method's parameter - invCtx = in[0].Interface().(context.Context) - } - start += 1 - } - } - - if end-start <= 0 { - inIArr = []interface{}{} - inVArr = []reflect.Value{} - } else if v, ok := in[start].Interface().([]interface{}); ok && end-start == 1 { - inIArr = v - inVArr = []reflect.Value{in[start]} - } else { - inIArr = make([]interface{}, end-start) - inVArr = make([]reflect.Value, end-start) - index := 0 - for i := start; i < end; i++ { - inIArr[index] = in[i].Interface() - inVArr[index] = in[i] - index++ - } - } - - inv = invocation_impl.NewRPCInvocationWithOptions(invocation_impl.WithMethodName(methodName), - invocation_impl.WithArguments(inIArr), - invocation_impl.WithCallBack(p.callback), invocation_impl.WithParameterValues(inVArr)) - if !replyEmptyFlag { - inv.SetReply(reply.Interface()) - } - - for k, value := range p.attachments { - inv.SetAttachment(k, value) - } - - // add user setAttachment. It is compatibility with previous versions. - atm := invCtx.Value(constant.AttachmentKey) - if m, ok := atm.(map[string]string); ok { - for k, value := range m { - inv.SetAttachment(k, value) - } - } else if m2, ok2 := atm.(map[string]interface{}); ok2 { - // it is support to transfer map[string]interface{}. It refers to dubbo-java 2.7. - for k, value := range m2 { - inv.SetAttachment(k, value) - } - } - - result := p.invoke.Invoke(invCtx, inv) - err = result.Error() - // cause is raw user level error - cause := perrors.Cause(err) - if err != nil { - // if some error happened, it should be log some info in the separate file. - if throwabler, ok := cause.(java_exception.Throwabler); ok { - logger.Warnf("[CallProxy] invoke service throw exception: %v , stackTraceElements: %v", cause.Error(), throwabler.GetStackTrace()) - } else { - // entire error is only for printing, do not return, because user would not want to deal with massive framework-level error message - logger.Warnf("[CallProxy] received rpc err: %v", err) - } - } else { - logger.Debugf("[CallProxy] received rpc result successfully: %s", result) - } - if len(outs) == 1 { - return []reflect.Value{reflect.ValueOf(&cause).Elem()} - } - if len(outs) == 2 && outs[0].Kind() != reflect.Ptr { - return []reflect.Value{reply.Elem(), reflect.ValueOf(&cause).Elem()} - } - return []reflect.Value{reply, reflect.ValueOf(&cause).Elem()} - } - } - - if err := refectAndMakeObjectFunc(valueOfElem, makeDubboCallProxy); err != nil { - logger.Errorf("The type or combination type of RPCService %T must be a pointer of a struct. error is %s", v, err) - return - } -} - -func refectAndMakeObjectFunc(valueOfElem reflect.Value, makeDubboCallProxy func(methodName string, outs []reflect.Type) func(in []reflect.Value) []reflect.Value) error { - typeOf := valueOfElem.Type() - // check incoming interface, incoming interface's elem must be a struct. - if typeOf.Kind() != reflect.Struct { - return errors.New("invalid type kind") - } - numField := valueOfElem.NumField() - for i := 0; i < numField; i++ { - t := typeOf.Field(i) - methodName := t.Tag.Get("dubbo") - if methodName == "" { - methodName = t.Name - } - f := valueOfElem.Field(i) - if f.Kind() == reflect.Func && f.IsValid() && f.CanSet() { - outNum := t.Type.NumOut() - - if outNum != 1 && outNum != 2 { - logger.Warnf("method %s of mtype %v has wrong number of in out parameters %d; needs exactly 1/2", - t.Name, t.Type.String(), outNum) - continue - } - - // The latest return type of the method must be error. - if returnType := t.Type.Out(outNum - 1); returnType != typError { - logger.Warnf("the latest return type %s of method %q is not error", returnType, t.Name) - continue - } - - funcOuts := make([]reflect.Type, outNum) - for i := 0; i < outNum; i++ { - funcOuts[i] = t.Type.Out(i) - } - - // do method proxy here: - f.Set(reflect.MakeFunc(f.Type(), makeDubboCallProxy(methodName, funcOuts))) - logger.Debugf("set method [%s]", methodName) - } else if f.IsValid() && f.CanSet() { - // for struct combination - valueOfSub := reflect.New(t.Type) - valueOfElemInterface := valueOfSub.Elem() - if valueOfElemInterface.Type().Kind() == reflect.Struct { - if err := refectAndMakeObjectFunc(valueOfElemInterface, makeDubboCallProxy); err != nil { - return err - } - f.Set(valueOfElemInterface) - } - } - } - return nil -} diff --git a/common/proxy/proxy_factory.go b/common/proxy/proxy_factory.go deleted file mode 100644 index ac987afe22..0000000000 --- a/common/proxy/proxy_factory.go +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package proxy - -import ( - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/protocol" -) - -type ProxyFactory interface { - GetProxy(invoker protocol.Invoker, url *common.URL) *Proxy - GetAsyncProxy(invoker protocol.Invoker, callBack interface{}, url *common.URL) *Proxy - GetInvoker(url *common.URL) protocol.Invoker -} - -// Option will define a function of handling ProxyFactory -type Option func(ProxyFactory) diff --git a/common/proxy/proxy_factory/default.go b/common/proxy/proxy_factory/default.go deleted file mode 100644 index 2c949846e4..0000000000 --- a/common/proxy/proxy_factory/default.go +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package proxy_factory - -import ( - "context" - "reflect" - "strings" - - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/protocol" - "dubbo.apache.org/dubbo-go/v3/proxy" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" -) - -func init() { - extension.SetProxyFactory("default", NewDefaultProxyFactory) -} - -// DefaultProxyFactory is the default proxy factory -type DefaultProxyFactory struct { // delegate ProxyFactory -} - -// you can rewrite DefaultProxyFactory in extension and delegate the default proxy factory like below - -//func WithDelegate(delegateProxyFactory ProxyFactory) Option { -// return func(proxy ProxyFactory) { -// proxy.(*DefaultProxyFactory).delegate = delegateProxyFactory -// } -//} - -// NewDefaultProxyFactory returns a proxy factory instance -func NewDefaultProxyFactory(_ ...proxy.Option) proxy.ProxyFactory { - return &DefaultProxyFactory{} -} - -// GetProxy gets a proxy -func (factory *DefaultProxyFactory) GetProxy(invoker protocol.Invoker, url *common.URL) *proxy.Proxy { - return factory.GetAsyncProxy(invoker, nil, url) -} - -// GetAsyncProxy gets a async proxy -func (factory *DefaultProxyFactory) GetAsyncProxy(invoker protocol.Invoker, callBack interface{}, url *common.URL) *proxy.Proxy { - // create proxy - attachments := map[string]string{} - attachments[constant.AsyncKey] = url.GetParam(constant.AsyncKey, "false") - attachments[constant.EnvironmentKey] = url.GetParam(constant.EnvironmentKey, "dev") - return proxy.NewProxy(invoker, callBack, attachments) -} - -// GetInvoker gets a invoker -func (factory *DefaultProxyFactory) GetInvoker(url *common.URL) protocol.Invoker { - return &ProxyInvoker{ - BaseInvoker: *protocol.NewBaseInvoker(url), - } -} - -// ProxyInvoker is a invoker struct -type ProxyInvoker struct { - protocol.BaseInvoker -} - -// Invoke is used to call service method by invocation -func (pi *ProxyInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result { - result := &protocol.RPCResult{} - result.SetAttachments(invocation.Attachments()) - - // get providerUrl. The origin url may be is registry URL. - url := getProviderURL(pi.GetURL()) - - methodName := invocation.MethodName() - proto := url.Protocol - path := strings.TrimPrefix(url.Path, "/") - args := invocation.Arguments() - - // get service - svc := common.ServiceMap.GetServiceByServiceKey(proto, url.ServiceKey()) - if svc == nil { - logger.Errorf("cannot find service [%s] in %s", path, proto) - result.SetError(perrors.Errorf("cannot find service [%s] in %s", path, proto)) - return result - } - - // get method - method := svc.Method()[methodName] - if method == nil { - logger.Errorf("cannot find method [%s] of service [%s] in %s", methodName, path, proto) - result.SetError(perrors.Errorf("cannot find method [%s] of service [%s] in %s", methodName, path, proto)) - return result - } - - in := []reflect.Value{svc.Rcvr()} - if method.CtxType() != nil { - ctx = context.WithValue(ctx, constant.AttachmentKey, invocation.Attachments()) - in = append(in, method.SuiteContext(ctx)) - } - - // prepare argv - if (len(method.ArgsType()) == 1 || len(method.ArgsType()) == 2 && method.ReplyType() == nil) && method.ArgsType()[0].String() == "[]interface {}" { - in = append(in, reflect.ValueOf(args)) - } else { - for i := 0; i < len(args); i++ { - t := reflect.ValueOf(args[i]) - if !t.IsValid() { - at := method.ArgsType()[i] - if at.Kind() == reflect.Ptr { - at = at.Elem() - } - t = reflect.New(at) - } - in = append(in, t) - } - } - - // prepare replyv - var replyv reflect.Value - var retErr interface{} - - returnValues, callErr := callLocalMethod(method.Method(), in) - - if callErr != nil { - logger.Errorf("Invoke function error: %+v, service: %#v", callErr, url) - result.SetError(callErr) - return result - } - - if len(returnValues) == 1 { - retErr = returnValues[0].Interface() - } else { - replyv = returnValues[0] - retErr = returnValues[1].Interface() - } - - if retErr != nil { - result.SetError(retErr.(error)) - return result - } - if replyv.IsValid() && (replyv.Kind() != reflect.Ptr || replyv.Kind() == reflect.Ptr && replyv.Elem().IsValid()) { - result.SetResult(replyv.Interface()) - } - - return result -} - -func getProviderURL(url *common.URL) *common.URL { - if url.SubURL == nil { - return url - } - return url.SubURL -} diff --git a/common/proxy/proxy_factory/default_test.go b/common/proxy/proxy_factory/default_test.go deleted file mode 100644 index 05ef1c53de..0000000000 --- a/common/proxy/proxy_factory/default_test.go +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package proxy_factory - -import ( - "fmt" - "testing" -) - -import ( - "github.com/stretchr/testify/assert" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/protocol" -) - -func TestGetProxy(t *testing.T) { - proxyFactory := NewDefaultProxyFactory() - url := common.NewURLWithOptions() - proxy := proxyFactory.GetProxy(protocol.NewBaseInvoker(url), url) - assert.NotNil(t, proxy) -} - -type TestAsync struct{} - -func (u *TestAsync) CallBack(res common.CallbackResponse) { - fmt.Println("CallBack res:", res) -} - -func TestGetAsyncProxy(t *testing.T) { - proxyFactory := NewDefaultProxyFactory() - url := common.NewURLWithOptions() - async := &TestAsync{} - proxy := proxyFactory.GetAsyncProxy(protocol.NewBaseInvoker(url), async.CallBack, url) - assert.NotNil(t, proxy) -} - -func TestGetInvoker(t *testing.T) { - proxyFactory := NewDefaultProxyFactory() - url := common.NewURLWithOptions() - invoker := proxyFactory.GetInvoker(url) - assert.True(t, invoker.IsAvailable()) -} diff --git a/common/proxy/proxy_factory/pass_through.go b/common/proxy/proxy_factory/pass_through.go deleted file mode 100644 index 5b5fa74f68..0000000000 --- a/common/proxy/proxy_factory/pass_through.go +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package proxy_factory - -import ( - "context" - "reflect" - - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/protocol" - "dubbo.apache.org/dubbo-go/v3/proxy" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" -) - -func init() { - extension.SetProxyFactory(constant.PassThroughProxyFactoryKey, NewPassThroughProxyFactory) -} - -// PassThroughProxyFactory is the factory of PassThroughProxyInvoker -type PassThroughProxyFactory struct { -} - -// NewPassThroughProxyFactory returns a proxy factory instance -func NewPassThroughProxyFactory(_ ...proxy.Option) proxy.ProxyFactory { - return &PassThroughProxyFactory{} -} - -// GetProxy gets a proxy -func (factory *PassThroughProxyFactory) GetProxy(invoker protocol.Invoker, url *common.URL) *proxy.Proxy { - return factory.GetAsyncProxy(invoker, nil, url) -} - -// GetAsyncProxy gets a async proxy -func (factory *PassThroughProxyFactory) GetAsyncProxy(invoker protocol.Invoker, callBack interface{}, url *common.URL) *proxy.Proxy { - //create proxy - attachments := map[string]string{} - attachments[constant.AsyncKey] = url.GetParam(constant.AsyncKey, "false") - return proxy.NewProxy(invoker, callBack, attachments) -} - -// GetInvoker gets a invoker -func (factory *PassThroughProxyFactory) GetInvoker(url *common.URL) protocol.Invoker { - return &PassThroughProxyInvoker{ - ProxyInvoker: &ProxyInvoker{ - BaseInvoker: *protocol.NewBaseInvoker(url), - }, - } -} - -// PassThroughProxyInvoker is a invoker struct, it calls service with specific method 'Serivce' and params: -// Service(method string, argsTypes []string, args [][]byte, attachment map[string]interface{}) -// PassThroughProxyInvoker pass through raw invocation data and method name to service, which will deal with them. -type PassThroughProxyInvoker struct { - *ProxyInvoker -} - -// Invoke is used to call service method by invocation -func (pi *PassThroughProxyInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result { - result := &protocol.RPCResult{} - result.SetAttachments(invocation.Attachments()) - url := getProviderURL(pi.GetURL()) - - arguments := invocation.Arguments() - srv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey()) - - var args [][]byte - if len(arguments) > 0 { - args = make([][]byte, 0, len(arguments)) - for _, arg := range arguments { - if v, ok := arg.([]byte); ok { - args = append(args, v) - } else { - result.Err = perrors.New("the param type is not []byte") - return result - } - } - } - method := srv.Method()["Service"] - - in := make([]reflect.Value, 5) - in = append(in, srv.Rcvr()) - in = append(in, reflect.ValueOf(invocation.MethodName())) - in = append(in, reflect.ValueOf(invocation.GetAttachmentInterface(constant.ParamsTypeKey))) - in = append(in, reflect.ValueOf(args)) - in = append(in, reflect.ValueOf(invocation.Attachments())) - - var replyv reflect.Value - var retErr interface{} - - returnValues, callErr := callLocalMethod(method.Method(), in) - - if callErr != nil { - logger.Errorf("Invoke function error: %+v, service: %#v", callErr, url) - result.SetError(callErr) - return result - } - - replyv = returnValues[0] - retErr = returnValues[1].Interface() - - if retErr != nil { - result.SetError(retErr.(error)) - return result - } - if replyv.IsValid() && (replyv.Kind() != reflect.Ptr || replyv.Kind() == reflect.Ptr && replyv.Elem().IsValid()) { - result.SetResult(replyv.Interface()) - } - - return result -} diff --git a/common/proxy/proxy_factory/pass_through_test.go b/common/proxy/proxy_factory/pass_through_test.go deleted file mode 100644 index 1d004c9805..0000000000 --- a/common/proxy/proxy_factory/pass_through_test.go +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package proxy_factory - -import ( - "fmt" - "testing" -) - -import ( - "github.com/stretchr/testify/assert" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/protocol" -) - -func TestPassThroughProxyFactoryGetProxy(t *testing.T) { - proxyFactory := NewPassThroughProxyFactory() - url := common.NewURLWithOptions() - proxy := proxyFactory.GetProxy(protocol.NewBaseInvoker(url), url) - assert.NotNil(t, proxy) -} - -type TestPassThroughProxyFactoryAsync struct { -} - -func (u *TestPassThroughProxyFactoryAsync) CallBack(res common.CallbackResponse) { - fmt.Println("CallBack res:", res) -} - -func TestPassThroughProxyFactoryGetAsyncProxy(t *testing.T) { - proxyFactory := NewPassThroughProxyFactory() - url := common.NewURLWithOptions() - async := &TestPassThroughProxyFactoryAsync{} - proxy := proxyFactory.GetAsyncProxy(protocol.NewBaseInvoker(url), async.CallBack, url) - assert.NotNil(t, proxy) -} - -func TestPassThroughProxyFactoryGetInvoker(t *testing.T) { - proxyFactory := NewPassThroughProxyFactory() - url := common.NewURLWithOptions() - invoker := proxyFactory.GetInvoker(url) - assert.True(t, invoker.IsAvailable()) -} diff --git a/common/proxy/proxy_factory/utils.go b/common/proxy/proxy_factory/utils.go deleted file mode 100644 index 44af7d28c0..0000000000 --- a/common/proxy/proxy_factory/utils.go +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package proxy_factory - -import ( - "fmt" - "reflect" -) - -import ( - perrors "github.com/pkg/errors" -) - -// CallLocalMethod is used to handle invoke exception in user func. -func callLocalMethod(method reflect.Method, in []reflect.Value) ([]reflect.Value, error) { - var ( - returnValues []reflect.Value - retErr error - ) - - func() { - defer func() { - if e := recover(); e != nil { - if err, ok := e.(error); ok { - retErr = err - } else if err, ok := e.(string); ok { - retErr = perrors.New(err) - } else { - retErr = fmt.Errorf("invoke function error, unknow exception: %+v", e) - } - } - }() - - returnValues = method.Func.Call(in) - }() - - if retErr != nil { - return nil, retErr - } - - return returnValues, retErr -} diff --git a/common/proxy/proxy_test.go b/common/proxy/proxy_test.go deleted file mode 100644 index 835e42121f..0000000000 --- a/common/proxy/proxy_test.go +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package proxy - -import ( - "context" - "fmt" - "reflect" - "testing" -) - -import ( - perrors "github.com/pkg/errors" - - "github.com/stretchr/testify/assert" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/protocol" - "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/hessian2" - "dubbo.apache.org/dubbo-go/v3/protocol/invocation" -) - -type TestService struct { - MethodOne func(context.Context, int, bool, *interface{}) error - MethodTwo func([]interface{}) error - MethodThree func(int, bool) (interface{}, error) - MethodFour func(int, bool) (*interface{}, error) `dubbo:"methodFour"` - MethodFive func() error - MethodSix func(context.Context, string) (interface{}, error) - Echo func(interface{}, *interface{}) error -} - -func (s *TestService) Reference() string { - return "com.test.Path" -} - -type TestServiceInt int - -func (s *TestServiceInt) Reference() string { - return "com.test.TestServiceInt" -} - -func TestProxyImplement(t *testing.T) { - invoker := protocol.NewBaseInvoker(&common.URL{}) - p := NewProxy(invoker, nil, map[string]string{constant.AsyncKey: "false"}) - s := &TestService{} - p.Implement(s) - - err := p.Get().(*TestService).MethodOne(nil, 0, false, nil) - assert.NoError(t, err) - - err = p.Get().(*TestService).MethodTwo(nil) - assert.NoError(t, err) - ret, err := p.Get().(*TestService).MethodThree(0, false) - assert.NoError(t, err) - assert.Nil(t, ret) // ret is nil, because it doesn't be injection yet - - ret2, err := p.Get().(*TestService).MethodFour(0, false) - assert.NoError(t, err) - assert.Equal(t, "*interface {}", reflect.TypeOf(ret2).String()) - err = p.Get().(*TestService).Echo(nil, nil) - assert.NoError(t, err) - - err = p.Get().(*TestService).MethodFive() - assert.NoError(t, err) - - // inherit & lowercase - p.rpc = nil - type S1 struct { - TestService - methodOne func(context.Context, interface{}, *struct{}) error - } - s1 := &S1{TestService: *s, methodOne: func(_ context.Context, _ interface{}, _ *struct{}) error { - return perrors.New("errors") - }} - p.Implement(s1) - err = s1.MethodOne(nil, 0, false, nil) - assert.NoError(t, err) - err = s1.methodOne(nil, nil, nil) - assert.EqualError(t, err, "errors") - - // no struct - p.rpc = nil - it := TestServiceInt(1) - p.Implement(&it) - assert.Nil(t, p.rpc) - - // return number - p.rpc = nil - type S2 struct { - TestService - MethodOne func([]interface{}) (*struct{}, int, error) - } - s2 := &S2{TestService: *s} - p.Implement(s2) - assert.Nil(t, s2.MethodOne) - - // returns type - p.rpc = nil - type S3 struct { - TestService - MethodOne func(context.Context, []interface{}, *struct{}) interface{} - } - s3 := &S3{TestService: *s} - p.Implement(s3) - assert.Nil(t, s3.MethodOne) -} - -func TestProxyImplementForContext(t *testing.T) { - invoker := &TestProxyInvoker{ - BaseInvoker: *protocol.NewBaseInvoker(&common.URL{}), - } - p := NewProxy(invoker, nil, map[string]string{constant.AsyncKey: "false"}) - s := &TestService{} - p.Implement(s) - attachments1 := make(map[string]interface{}, 4) - attachments1["k1"] = "v1" - attachments1["k2"] = "v2" - context := context.WithValue(context.Background(), constant.AttachmentKey, attachments1) - r, err := p.Get().(*TestService).MethodSix(context, "xxx") - v1 := r.(map[string]interface{}) - assert.NoError(t, err) - assert.Equal(t, v1["TestProxyInvoker"], "TestProxyInvokerValue") -} - -type TestProxyInvoker struct { - protocol.BaseInvoker -} - -func (bi *TestProxyInvoker) Invoke(_ context.Context, inv protocol.Invocation) protocol.Result { - rpcInv := inv.(*invocation.RPCInvocation) - mapV := inv.Attachments() - mapV["TestProxyInvoker"] = "TestProxyInvokerValue" - if err := hessian2.ReflectResponse(mapV, rpcInv.Reply()); err != nil { - fmt.Printf("hessian2.ReflectResponse(mapV:%v) = error:%v", mapV, err) - } - - return &protocol.RPCResult{ - Rest: inv.Arguments(), - } -} diff --git a/common/yaml/testdata/config.yml b/common/yaml/testdata/config.yml deleted file mode 100644 index a56c842529..0000000000 --- a/common/yaml/testdata/config.yml +++ /dev/null @@ -1,7 +0,0 @@ - -intTest: 11 -booleanTest: false -strTest: "strTest" - -child: - strTest: "childStrTest" \ No newline at end of file diff --git a/common/yaml/yaml.go b/common/yaml/yaml.go deleted file mode 100644 index 1284395793..0000000000 --- a/common/yaml/yaml.go +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package yaml - -import ( - "io/ioutil" - "path" -) - -import ( - perrors "github.com/pkg/errors" - - "gopkg.in/yaml.v2" -) - -// LoadYMLConfig Load yml config byte from file -func LoadYMLConfig(confProFile string) ([]byte, error) { - if len(confProFile) == 0 { - return nil, perrors.Errorf("application configure(provider) file name is nil") - } - - if path.Ext(confProFile) != ".yml" { - return nil, perrors.Errorf("application configure file name{%v} suffix must be .yml", confProFile) - } - - return ioutil.ReadFile(confProFile) -} - -// UnmarshalYMLConfig Load yml config byte from file, then unmarshal to object -func UnmarshalYMLConfig(confProFile string, out interface{}) ([]byte, error) { - confFileStream, err := LoadYMLConfig(confProFile) - if err != nil { - return confFileStream, perrors.Errorf("ioutil.ReadFile(file:%s) = error:%v", confProFile, perrors.WithStack(err)) - } - return confFileStream, yaml.Unmarshal(confFileStream, out) -} - -// UnmarshalYML unmarshals decodes the first document found within the in byte slice and assigns decoded values into the out value. -func UnmarshalYML(data []byte, out interface{}) error { - return yaml.Unmarshal(data, out) -} - -// MarshalYML serializes the value provided into a YAML document. -func MarshalYML(in interface{}) ([]byte, error) { - return yaml.Marshal(in) -} diff --git a/common/yaml/yaml_test.go b/common/yaml/yaml_test.go deleted file mode 100644 index 19f4fe148a..0000000000 --- a/common/yaml/yaml_test.go +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package yaml - -import ( - "path/filepath" - "testing" -) - -import ( - "github.com/stretchr/testify/assert" -) - -func TestUnmarshalYMLConfig(t *testing.T) { - conPath, err := filepath.Abs("./testdata/config.yml") - assert.NoError(t, err) - c := &Config{} - _, err = UnmarshalYMLConfig(conPath, c) - assert.NoError(t, err) - assert.Equal(t, "strTest", c.StrTest) - assert.Equal(t, 11, c.IntTest) - assert.Equal(t, false, c.BooleanTest) - assert.Equal(t, "childStrTest", c.ChildConfig.StrTest) -} - -func TestUnmarshalYMLConfigError(t *testing.T) { - c := &Config{} - _, err := UnmarshalYMLConfig("./testdata/config", c) - assert.Error(t, err) - _, err = UnmarshalYMLConfig("", c) - assert.Error(t, err) -} - -func TestUnmarshalYML(t *testing.T) { - c := &Config{} - b, err := LoadYMLConfig("./testdata/config.yml") - assert.NoError(t, err) - err = UnmarshalYML(b, c) - assert.NoError(t, err) - assert.Equal(t, "strTest", c.StrTest) - assert.Equal(t, 11, c.IntTest) - assert.Equal(t, false, c.BooleanTest) - assert.Equal(t, "childStrTest", c.ChildConfig.StrTest) -} - -type Config struct { - StrTest string `yaml:"strTest" default:"default" json:"strTest,omitempty" property:"strTest"` - IntTest int `default:"109" yaml:"intTest" json:"intTest,omitempty" property:"intTest"` - BooleanTest bool `yaml:"booleanTest" default:"true" json:"booleanTest,omitempty"` - ChildConfig ChildConfig `yaml:"child" json:"child,omitempty"` -} - -type ChildConfig struct { - StrTest string `default:"default" yaml:"strTest" json:"strTest,omitempty"` -} From 40687df7a8e130df0cc403f05af85fca12c028cd Mon Sep 17 00:00:00 2001 From: Leospard <694963063@qq.com> Date: Sat, 2 Jul 2022 10:16:32 +0800 Subject: [PATCH 6/8] modify import path by imports-formatter --- .../cluster/adaptivesvc/cluster_invoker.go | 11 ++++++++--- cluster/cluster/base/cluster_invoker.go | 8 ++++++-- cluster/cluster/broadcast/cluster_invoker.go | 7 ++++++- cluster/cluster/failback/cluster_invoker.go | 10 ++++++++-- cluster/cluster/failover/cluster_invoker.go | 10 ++++++++-- cluster/cluster/failsafe/cluster_invoker.go | 7 ++++++- cluster/cluster/forking/cluster_invoker.go | 10 ++++++++-- cluster/cluster/mock.go | 10 ++++++++-- cluster/loadbalance/p2c/loadbalance.go | 7 ++++++- cluster/loadbalance/ringhash/ringhash.go | 7 ++++++- cluster/router/chain/chain.go | 13 ++++++++++--- cluster/router/meshrouter/meshrouter.go | 7 ++++++- cluster/router/tag/match.go | 7 ++++++- cluster/router/tag/router.go | 9 +++++++-- common/extension/proxy_factory.go | 5 ++++- common/rpc_service.go | 3 +++ config/config_center_config.go | 11 +++++++++-- config/config_loader_options.go | 11 +++++++++-- config/config_loader_options_test.go | 7 ++++++- config/config_resolver.go | 5 ++++- config/consumer_config.go | 10 ++++++++-- config/graceful_shutdown.go | 9 +++++++-- config/graceful_shutdown_config.go | 9 ++++++++- config/logger_config.go | 10 +++++++++- config/logger_config_test.go | 3 +++ config/metadata_report_config.go | 8 ++++++-- config/provider_config.go | 11 ++++++++--- config/reference_config.go | 7 ++++++- config/reference_config_test.go | 6 +++++- config/registry_config.go | 10 ++++++++-- config/root_config.go | 14 +++++++++++--- config/root_config_test.go | 10 ++++++++-- config/service_config.go | 12 +++++++++--- config/service_config_test.go | 8 ++++++-- config_center/apollo/impl.go | 11 ++++++++--- config_center/apollo/listener.go | 8 ++++++-- config_center/file/listener.go | 10 ++++++++-- config_center/nacos/client.go | 9 +++++++-- config_center/nacos/facade.go | 7 ++++++- config_center/nacos/impl.go | 10 +++++++--- config_center/nacos/listener.go | 12 +++++++++--- config_center/parser/configuration_parser.go | 13 ++++++++++--- config_center/zookeeper/impl.go | 10 +++++++--- filter/accesslog/filter.go | 7 ++++++- filter/active/filter.go | 8 ++++++-- filter/adaptivesvc/filter.go | 10 ++++++++-- filter/adaptivesvc/limiter/utils.go | 2 ++ filter/auth/provider_auth_filter.go | 7 ++++++- filter/auth/sign_util.go | 2 ++ filter/exec_limit/filter.go | 11 ++++++++--- filter/generic/filter.go | 11 ++++++++--- filter/generic/generalizer/gson.go | 8 +++++++- filter/generic/generalizer/map.go | 11 +++++++++-- filter/generic/service_filter.go | 11 ++++++++--- filter/generic/util.go | 7 ++++++- filter/graceful_shutdown/consumer_filter.go | 7 ++++++- filter/graceful_shutdown/provider_filter.go | 7 ++++++- .../rejected_execution_handler_only_log.go | 7 ++++++- filter/hystrix/filter.go | 13 ++++++++++--- filter/seata/filter.go | 7 ++++++- filter/sentinel/filter.go | 14 ++++++++++---- filter/tps/filter.go | 9 ++++++--- filter/tps/limiter/method_service.go | 10 ++++++++-- filter/xds/cb/filter.go | 7 ++++++- .../mapping/metadata/service_name_mapping.go | 9 +++++++-- metadata/report/delegate/delegate_report.go | 13 ++++++++++--- .../report/delegate/delegate_report_test.go | 13 ++++++++++--- metadata/report/etcd/report.go | 10 +++++++--- metadata/report/nacos/report.go | 11 ++++++++--- metadata/report/zookeeper/report.go | 8 ++++++-- .../service/exporter/configurable/exporter.go | 10 ++++++---- .../exporter/configurable/exporter_test.go | 11 ++++++----- .../local/metadata_service_proxy_factory.go | 7 ++++++- metadata/service/local/service.go | 10 ++++++++-- metadata/service/local/service_proxy.go | 7 ++++++- metadata/service/remote/service.go | 10 ++++++++-- metadata/service/remote/service_test.go | 12 +++++++++--- metrics/prometheus/reporter.go | 10 ++++++++-- protocol/dubbo/dubbo_codec.go | 11 ++++++++--- protocol/dubbo/dubbo_exporter.go | 7 ++++++- protocol/dubbo/dubbo_invoker.go | 11 ++++++++--- protocol/dubbo/dubbo_protocol.go | 10 ++++++++-- protocol/dubbo/dubbo_protocol_test.go | 7 ++++++- protocol/dubbo/hessian2/hessian_request.go | 3 +++ protocol/dubbo/hessian2/hessian_response.go | 3 +++ protocol/dubbo/impl/codec.go | 10 ++++++++-- protocol/dubbo/impl/hessian.go | 10 ++++++++-- protocol/dubbo3/dubbo3_exporter.go | 10 ++++++++-- protocol/dubbo3/dubbo3_invoker.go | 12 ++++++++---- protocol/dubbo3/dubbo3_protocol.go | 11 ++++++++--- protocol/dubbo3/internal/server.go | 10 ++++++---- protocol/grpc/client.go | 15 ++++++++++++--- protocol/grpc/grpc_exporter.go | 7 ++++++- protocol/grpc/grpc_invoker.go | 12 ++++++++++-- protocol/grpc/grpc_protocol.go | 7 ++++++- protocol/grpc/internal/helloworld/server.go | 6 ++++-- protocol/grpc/internal/routeguide/client.go | 7 ++++++- protocol/grpc/internal/routeguide/server.go | 7 +++++-- protocol/grpc/server.go | 14 +++++++++++--- protocol/invoker.go | 10 ++++++++-- protocol/jsonrpc/http.go | 10 ++++++++-- protocol/jsonrpc/http_test.go | 2 ++ protocol/jsonrpc/jsonrpc_exporter.go | 7 ++++++- protocol/jsonrpc/jsonrpc_invoker.go | 8 ++++++-- protocol/jsonrpc/jsonrpc_protocol.go | 7 ++++++- protocol/jsonrpc/server.go | 10 ++++++++-- protocol/protocol.go | 7 ++++++- .../protocol_filter_wrapper.go | 7 ++++++- .../protocol_filter_wrapper_test.go | 10 ++++++++-- .../rest/config/reader/rest_config_reader.go | 13 ++++++++++--- .../config/reader/rest_config_reader_test.go | 8 +++++++- protocol/rest/rest_exporter.go | 7 ++++++- protocol/rest/rest_protocol.go | 11 ++++++----- protocol/rest/server/rest_server.go | 11 ++++++++--- .../server/server_impl/go_restful_server.go | 10 ++++++++-- protocol/rpc_status.go | 10 ++++++++-- proxy/proxy.go | 11 ++++++++--- proxy/proxy_factory/default.go | 10 ++++++++-- proxy/proxy_factory/pass_through.go | 10 ++++++++-- registry/base_configuration_listener.go | 8 ++++++-- registry/base_registry.go | 10 ++++++++-- registry/directory/directory.go | 11 ++++++++--- registry/etcdv3/listener.go | 9 +++++++-- registry/etcdv3/registry.go | 9 +++++++-- registry/etcdv3/service_discovery.go | 12 ++++++++---- registry/event.go | 7 ++++++- registry/event/base_configuration_listener.go | 8 ++++++-- .../metadata_service_url_params_customizer.go | 9 +++++++-- .../protocol_ports_metadata_customizer.go | 7 ++++++- ...service_instances_changed_listener_impl.go | 11 ++++++++--- registry/event/service_revision_customizer.go | 7 ++++++- registry/mock_registry.go | 8 +++++++- registry/nacos/listener.go | 11 ++++++++--- registry/nacos/registry.go | 10 ++++++++-- registry/nacos/service_discovery.go | 11 ++++++++--- registry/polaris/listener.go | 12 +++++++++--- registry/polaris/registry.go | 15 +++++++++++---- registry/polaris/service_discovery.go | 15 ++++++++++----- registry/protocol/protocol.go | 11 +++++++---- registry/service_instance.go | 9 +++++++-- .../service_instances_changed_listener.go | 2 ++ .../service_discovery_registry.go | 12 +++++++++--- registry/xds/registry.go | 11 ++++++++--- registry/zookeeper/listener.go | 9 +++++++-- registry/zookeeper/registry.go | 9 +++++++-- registry/zookeeper/service_discovery.go | 9 ++++++--- remoting/etcdv3/client.go | 2 +- remoting/etcdv3/facade.go | 7 ++++++- remoting/etcdv3/listener.go | 10 ++++++++-- remoting/exchange.go | 8 +++++++- remoting/exchange_client.go | 10 ++++++++-- remoting/getty/getty_client.go | 16 +++++++++++----- remoting/getty/getty_client_test.go | 7 ++++++- remoting/getty/getty_server.go | 12 +++++++++--- remoting/getty/listener.go | 9 +++++++-- remoting/getty/pool.go | 8 +++++++- remoting/getty/readwriter.go | 10 ++++++++-- remoting/getty/readwriter_test.go | 10 ++++++++-- remoting/nacos/builder.go | 9 +++++++-- remoting/xds/client.go | 11 ++++++++--- remoting/xds/ewatcher/ewatcher.go | 8 ++++++-- remoting/xds/mapping/handler.go | 10 ++++++++-- remoting/zookeeper/client.go | 9 +++++++-- .../curator_discovery/service_discovery.go | 9 +++++++-- remoting/zookeeper/facade.go | 7 ++++++- remoting/zookeeper/listener.go | 9 +++++++-- xds/balancer/cdsbalancer/cdsbalancer.go | 13 ++++++++++--- xds/balancer/clusterimpl/clusterimpl.go | 11 +++++++++-- xds/balancer/clusterimpl/picker.go | 5 ++++- .../clustermanager/balancerstateaggregator.go | 7 +++++-- xds/balancer/clustermanager/clustermanager.go | 9 ++++++++- .../clusterresolver/clusterresolver.go | 11 ++++++++++- xds/balancer/clusterresolver/configbuilder.go | 9 +++++++-- xds/balancer/orca/orca.go | 8 ++++++-- xds/balancer/priority/balancer.go | 9 ++++++++- xds/balancer/ringhash/picker.go | 9 +++++++-- xds/balancer/ringhash/ringhash.go | 10 +++++++++- xds/client/authority.go | 7 ++++++- xds/client/bootstrap/bootstrap.go | 11 ++++++++--- xds/client/client.go | 8 ++++++-- xds/client/controller.go | 5 ++++- xds/client/controller/controller.go | 8 +++++++- xds/client/controller/version/v2/client.go | 14 +++++++++----- xds/client/controller/version/v3/client.go | 14 +++++++++----- xds/client/controller/version/version.go | 10 ++++++++-- xds/client/pubsub/pubsub.go | 7 ++++++- xds/client/resource/filter_chain.go | 9 +++++++-- xds/client/resource/unmarshal.go | 6 ++++-- xds/client/resource/unmarshal_cds.go | 11 ++++++++--- xds/client/resource/unmarshal_eds.go | 10 ++++++++-- xds/client/resource/unmarshal_lds.go | 11 ++++++++--- xds/client/resource/unmarshal_rds.go | 10 +++++++++- xds/csds/csds.go | 19 +++++++++++-------- xds/resolver/watch_service.go | 7 ++++++- xds/resolver/xds_resolver.go | 9 +++++++-- xds/server/listener_wrapper.go | 10 ++++++++-- xds/utils/balancergroup/balancergroup.go | 10 ++++++++-- xds/utils/grpclog/grpclog.go | 2 ++ xds/utils/serviceconfig/serviceconfig.go | 6 +++++- 199 files changed, 1414 insertions(+), 402 deletions(-) diff --git a/cluster/cluster/adaptivesvc/cluster_invoker.go b/cluster/cluster/adaptivesvc/cluster_invoker.go index b7fdb2f631..7eaf456e8a 100644 --- a/cluster/cluster/adaptivesvc/cluster_invoker.go +++ b/cluster/cluster/adaptivesvc/cluster_invoker.go @@ -20,17 +20,22 @@ package adaptivesvc import ( "context" "strconv" +) + +import ( + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/cluster/cluster/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/cluster/metrics" - perrors "github.com/pkg/errors" - clsutils "dubbo.apache.org/dubbo-go/v3/cluster/utils" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) var _ protocol.Invoker = (*adaptiveServiceClusterInvoker)(nil) diff --git a/cluster/cluster/base/cluster_invoker.go b/cluster/cluster/base/cluster_invoker.go index cfc0c38158..2d01fad84b 100644 --- a/cluster/cluster/base/cluster_invoker.go +++ b/cluster/cluster/base/cluster_invoker.go @@ -19,16 +19,20 @@ package base import ( + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "go.uber.org/atomic" +) + +import ( "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - "go.uber.org/atomic" ) type BaseClusterInvoker struct { diff --git a/cluster/cluster/broadcast/cluster_invoker.go b/cluster/cluster/broadcast/cluster_invoker.go index 12c13eef0a..16850a5c00 100644 --- a/cluster/cluster/broadcast/cluster_invoker.go +++ b/cluster/cluster/broadcast/cluster_invoker.go @@ -19,11 +19,16 @@ package broadcast import ( "context" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/cluster/cluster/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) type broadcastClusterInvoker struct { diff --git a/cluster/cluster/failback/cluster_invoker.go b/cluster/cluster/failback/cluster_invoker.go index 48cad4cc89..f647e33a60 100644 --- a/cluster/cluster/failback/cluster_invoker.go +++ b/cluster/cluster/failback/cluster_invoker.go @@ -22,15 +22,21 @@ import ( "strconv" "sync" "time" +) + +import ( + "github.com/Workiva/go-datastructures/queue" + + "github.com/dubbogo/gost/log/logger" +) +import ( "dubbo.apache.org/dubbo-go/v3/cluster/cluster/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/Workiva/go-datastructures/queue" - "github.com/dubbogo/gost/log/logger" ) /** diff --git a/cluster/cluster/failover/cluster_invoker.go b/cluster/cluster/failover/cluster_invoker.go index 5ceaeceada..0d6db65c7e 100644 --- a/cluster/cluster/failover/cluster_invoker.go +++ b/cluster/cluster/failover/cluster_invoker.go @@ -21,14 +21,20 @@ import ( "context" "fmt" "strconv" +) + +import ( + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" +) +import ( "dubbo.apache.org/dubbo-go/v3/cluster/cluster/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) type failoverClusterInvoker struct { diff --git a/cluster/cluster/failsafe/cluster_invoker.go b/cluster/cluster/failsafe/cluster_invoker.go index 01d2c59e8e..95b109868a 100644 --- a/cluster/cluster/failsafe/cluster_invoker.go +++ b/cluster/cluster/failsafe/cluster_invoker.go @@ -19,13 +19,18 @@ package failsafe import ( "context" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/cluster/cluster/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) /** diff --git a/cluster/cluster/forking/cluster_invoker.go b/cluster/cluster/forking/cluster_invoker.go index 4cf4a5a510..2c35a9493f 100644 --- a/cluster/cluster/forking/cluster_invoker.go +++ b/cluster/cluster/forking/cluster_invoker.go @@ -21,13 +21,19 @@ import ( "context" "fmt" "time" +) + +import ( + "github.com/Workiva/go-datastructures/queue" + + "github.com/dubbogo/gost/log/logger" +) +import ( "dubbo.apache.org/dubbo-go/v3/cluster/cluster/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/Workiva/go-datastructures/queue" - "github.com/dubbogo/gost/log/logger" ) type forkingClusterInvoker struct { diff --git a/cluster/cluster/mock.go b/cluster/cluster/mock.go index ad01179c53..943fcf380c 100644 --- a/cluster/cluster/mock.go +++ b/cluster/cluster/mock.go @@ -19,12 +19,18 @@ package cluster import ( "context" +) + +import ( + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" +) +import ( "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) var Count int diff --git a/cluster/loadbalance/p2c/loadbalance.go b/cluster/loadbalance/p2c/loadbalance.go index ec12eab82a..7a044cc55f 100644 --- a/cluster/loadbalance/p2c/loadbalance.go +++ b/cluster/loadbalance/p2c/loadbalance.go @@ -23,13 +23,18 @@ import ( "math/rand" "sync" "time" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" "dubbo.apache.org/dubbo-go/v3/cluster/metrics" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) var ( diff --git a/cluster/loadbalance/ringhash/ringhash.go b/cluster/loadbalance/ringhash/ringhash.go index 5e3a34fc18..7ad96f5986 100644 --- a/cluster/loadbalance/ringhash/ringhash.go +++ b/cluster/loadbalance/ringhash/ringhash.go @@ -19,14 +19,19 @@ package ringhash import ( "strconv" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/remoting/xds" - "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/cluster/router/chain/chain.go b/cluster/router/chain/chain.go index 5847a455dc..037fa5554f 100644 --- a/cluster/router/chain/chain.go +++ b/cluster/router/chain/chain.go @@ -20,14 +20,21 @@ package chain import ( "sort" "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + + "go.uber.org/atomic" +) + +import ( "dubbo.apache.org/dubbo-go/v3/cluster/router" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - "go.uber.org/atomic" ) // RouterChain Router chain diff --git a/cluster/router/meshrouter/meshrouter.go b/cluster/router/meshrouter/meshrouter.go index 07566c7d0b..7a174f30b7 100644 --- a/cluster/router/meshrouter/meshrouter.go +++ b/cluster/router/meshrouter/meshrouter.go @@ -19,14 +19,19 @@ package meshrouter import ( "math/rand" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/cluster/router" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/remoting/xds" - "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/cluster/router/tag/match.go b/cluster/router/tag/match.go index dde7fb41c8..f9f900e032 100644 --- a/cluster/router/tag/match.go +++ b/cluster/router/tag/match.go @@ -19,12 +19,17 @@ package tag import ( "strconv" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) type predicate func(invoker protocol.Invoker, tag interface{}) bool diff --git a/cluster/router/tag/router.go b/cluster/router/tag/router.go index 5bbd1f78ff..d728772b9d 100644 --- a/cluster/router/tag/router.go +++ b/cluster/router/tag/router.go @@ -20,17 +20,22 @@ package tag import ( "strings" "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" - "dubbo.apache.org/dubbo-go/v3/common" "gopkg.in/yaml.v2" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common" conf "dubbo.apache.org/dubbo-go/v3/common/config" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" ) type PriorityRouter struct { diff --git a/common/extension/proxy_factory.go b/common/extension/proxy_factory.go index e9e3e5a6d3..5dfe0c9da5 100644 --- a/common/extension/proxy_factory.go +++ b/common/extension/proxy_factory.go @@ -18,10 +18,13 @@ package extension import ( - "dubbo.apache.org/dubbo-go/v3/proxy" "github.com/dubbogo/gost/log/logger" ) +import ( + "dubbo.apache.org/dubbo-go/v3/proxy" +) + var proxyFactories = make(map[string]func(...proxy.Option) proxy.ProxyFactory) // SetProxyFactory sets the ProxyFactory extension with @name diff --git a/common/rpc_service.go b/common/rpc_service.go index 4109e0ff55..95b4845f90 100644 --- a/common/rpc_service.go +++ b/common/rpc_service.go @@ -24,8 +24,11 @@ import ( "sync" "unicode" "unicode/utf8" +) +import ( "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) diff --git a/config/config_center_config.go b/config/config_center_config.go index 9af3b62955..0bab9089ef 100644 --- a/config/config_center_config.go +++ b/config/config_center_config.go @@ -20,17 +20,24 @@ package config import ( "net/url" "strings" +) - "dubbo.apache.org/dubbo-go/v3/common" +import ( "github.com/creasty/defaults" + + "github.com/dubbogo/gost/log/logger" + "github.com/knadh/koanf" + "github.com/pkg/errors" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common" conf "dubbo.apache.org/dubbo-go/v3/common/config" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config_center" - "github.com/dubbogo/gost/log/logger" ) // CenterConfig is configuration for config center diff --git a/config/config_loader_options.go b/config/config_loader_options.go index 80a3fe5c5c..61554f0da8 100644 --- a/config/config_loader_options.go +++ b/config/config_loader_options.go @@ -23,14 +23,21 @@ import ( "path/filepath" "runtime" "strings" +) - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/constant/file" +import ( "github.com/dubbogo/gost/log/logger" + "github.com/knadh/koanf" + "github.com/pkg/errors" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/common/constant/file" +) + type loaderConf struct { suffix string // loaderConf file extension default yaml path string // loaderConf file path default ./conf/dubbogo.yaml diff --git a/config/config_loader_options_test.go b/config/config_loader_options_test.go index a066da7f71..7c5e92b0e4 100644 --- a/config/config_loader_options_test.go +++ b/config/config_loader_options_test.go @@ -20,11 +20,16 @@ package config import ( "strings" "testing" +) - "dubbo.apache.org/dubbo-go/v3/common/constant/file" +import ( "github.com/stretchr/testify/assert" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant/file" +) + func TestCheckGenre(t *testing.T) { err := checkFileSuffix("abc") diff --git a/config/config_resolver.go b/config/config_resolver.go index b7b672219c..0e4eefd4a6 100644 --- a/config/config_resolver.go +++ b/config/config_resolver.go @@ -24,9 +24,12 @@ import ( "github.com/knadh/koanf/parsers/yaml" "github.com/knadh/koanf/providers/rawbytes" + "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant/file" "dubbo.apache.org/dubbo-go/v3/config/parsers/properties" - "github.com/pkg/errors" ) // GetConfigResolver get config resolver diff --git a/config/consumer_config.go b/config/consumer_config.go index 1ecc38d318..2fcbb69774 100644 --- a/config/consumer_config.go +++ b/config/consumer_config.go @@ -20,15 +20,21 @@ package config import ( "fmt" "time" +) +import ( "github.com/creasty/defaults" - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" "github.com/dubbogo/gost/log/logger" + tripleConstant "github.com/dubbogo/triple/pkg/common/constant" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" +) + const ( MaxWheelTimeSpan = 900e9 // 900s, 15 minute ) diff --git a/config/graceful_shutdown.go b/config/graceful_shutdown.go index 93c6de890f..76bb07d59a 100644 --- a/config/graceful_shutdown.go +++ b/config/graceful_shutdown.go @@ -22,13 +22,18 @@ import ( "os/signal" "runtime/debug" "time" +) - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/extension" +import ( gxset "github.com/dubbogo/gost/container/set" "github.com/dubbogo/gost/log/logger" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/common/extension" +) + /* * The key point is that find out the signals to handle. * The most important documentation is https://golang.org/pkg/os/signal/ diff --git a/config/graceful_shutdown_config.go b/config/graceful_shutdown_config.go index b5d7753dfd..93ea9d3aeb 100644 --- a/config/graceful_shutdown_config.go +++ b/config/graceful_shutdown_config.go @@ -19,13 +19,20 @@ package config import ( "time" +) - "dubbo.apache.org/dubbo-go/v3/common/constant" +import ( "github.com/creasty/defaults" + "github.com/dubbogo/gost/log/logger" + "go.uber.org/atomic" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" +) + const ( defaultTimeout = 60 * time.Second defaultStepTimeout = 3 * time.Second diff --git a/config/logger_config.go b/config/logger_config.go index 9a8c7fc3c9..30f7be1a42 100644 --- a/config/logger_config.go +++ b/config/logger_config.go @@ -19,16 +19,24 @@ package config import ( "net/url" +) - "dubbo.apache.org/dubbo-go/v3/common/constant" +import ( "github.com/creasty/defaults" + "github.com/dubbogo/gost/encoding/yaml" "github.com/dubbogo/gost/log/logger" + "github.com/natefinch/lumberjack" + "go.uber.org/zap" "go.uber.org/zap/zapcore" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" +) + type ZapConfig struct { Level string `default:"info" json:"level,omitempty" yaml:"level" property:"level"` Development bool `default:"false" json:"development,omitempty" yaml:"development" property:"development"` diff --git a/config/logger_config_test.go b/config/logger_config_test.go index 26ba56f5ff..fdb9224cdd 100644 --- a/config/logger_config_test.go +++ b/config/logger_config_test.go @@ -19,8 +19,11 @@ package config import ( "testing" +) +import ( "github.com/dubbogo/gost/log/logger" + "github.com/stretchr/testify/assert" ) diff --git a/config/metadata_report_config.go b/config/metadata_report_config.go index 099c846127..837f7af8e0 100644 --- a/config/metadata_report_config.go +++ b/config/metadata_report_config.go @@ -17,13 +17,17 @@ package config +import ( + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" +) + import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config/instance" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) // MetadataReportConfig is app level configuration diff --git a/config/provider_config.go b/config/provider_config.go index 7ec9f4e106..d1b047c1ee 100644 --- a/config/provider_config.go +++ b/config/provider_config.go @@ -19,16 +19,21 @@ package config import ( "fmt" +) +import ( "github.com/creasty/defaults" + "github.com/dubbogo/gost/log/logger" + tripleConstant "github.com/dubbogo/triple/pkg/common/constant" - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "github.com/dubbogo/gost/log/logger" perrors "github.com/pkg/errors" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" aslimiter "dubbo.apache.org/dubbo-go/v3/filter/adaptivesvc/limiter" ) diff --git a/config/reference_config.go b/config/reference_config.go index 142bccb4e0..ffd462a28f 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -22,9 +22,15 @@ import ( "net/url" "strconv" "time" +) +import ( "github.com/creasty/defaults" + gxstrings "github.com/dubbogo/gost/strings" +) + +import ( "dubbo.apache.org/dubbo-go/v3/cluster/directory/static" "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" @@ -33,7 +39,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper" "dubbo.apache.org/dubbo-go/v3/proxy" - gxstrings "github.com/dubbogo/gost/strings" ) // ReferenceConfig is the configuration of service consumer diff --git a/config/reference_config_test.go b/config/reference_config_test.go index 3af9db1f64..01a3dab2d7 100644 --- a/config/reference_config_test.go +++ b/config/reference_config_test.go @@ -19,10 +19,14 @@ package config import ( "testing" +) - "dubbo.apache.org/dubbo-go/v3/common/constant" +import ( "github.com/stretchr/testify/assert" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" ) diff --git a/config/registry_config.go b/config/registry_config.go index d5ee614687..c8cf359ea5 100644 --- a/config/registry_config.go +++ b/config/registry_config.go @@ -21,16 +21,22 @@ import ( "net/url" "strconv" "strings" +) +import ( "github.com/creasty/defaults" + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config/instance" "dubbo.apache.org/dubbo-go/v3/registry" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) // RegistryConfig is the configuration of the registry center diff --git a/config/root_config.go b/config/root_config.go index 1b4b3ed2b4..e069274c36 100644 --- a/config/root_config.go +++ b/config/root_config.go @@ -20,18 +20,26 @@ package config import ( _ "net/http/pprof" "sync" +) +import ( hessian "github.com/apache/dubbo-go-hessian2" + + "github.com/dubbogo/gost/log/logger" + "github.com/knadh/koanf" + perrors "github.com/pkg/errors" + + "go.uber.org/atomic" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/metadata/service/exporter" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - "go.uber.org/atomic" ) var ( diff --git a/config/root_config_test.go b/config/root_config_test.go index 00640f3f27..e49e1456ea 100644 --- a/config/root_config_test.go +++ b/config/root_config_test.go @@ -19,13 +19,19 @@ package config import ( "testing" +) - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/config_center" +import ( "github.com/dubbogo/gost/encoding/yaml" + "github.com/stretchr/testify/assert" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/config_center" +) + func TestGoConfigProcess(t *testing.T) { rc := &RootConfigBuilder{rootConfig: newEmptyRootConfig()} r := &RegistryConfig{Protocol: "zookeeper", Timeout: "10s", Address: "127.0.0.1:2181"} diff --git a/config/service_config.go b/config/service_config.go index 69e6548588..b0f75cf385 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -26,19 +26,25 @@ import ( "strings" "sync" "time" +) +import ( "github.com/creasty/defaults" + "github.com/dubbogo/gost/log/logger" gxnet "github.com/dubbogo/gost/net" + perrors "github.com/pkg/errors" + + "go.uber.org/atomic" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - "go.uber.org/atomic" ) // ServiceConfig is the configuration of the service provider diff --git a/config/service_config_test.go b/config/service_config_test.go index c40fcc6250..5a0639f420 100644 --- a/config/service_config_test.go +++ b/config/service_config_test.go @@ -21,11 +21,15 @@ import ( "context" "strings" "testing" +) - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" +import ( "github.com/stretchr/testify/assert" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" ) diff --git a/config_center/apollo/impl.go b/config_center/apollo/impl.go index 07e8256ce6..5d34affcf1 100644 --- a/config_center/apollo/impl.go +++ b/config_center/apollo/impl.go @@ -22,16 +22,21 @@ import ( "regexp" "strings" "sync" +) +import ( gxset "github.com/dubbogo/gost/container/set" - - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + "github.com/zouyx/agollo/v3" "github.com/zouyx/agollo/v3/env/config" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" cc "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/config_center/parser" ) diff --git a/config_center/apollo/listener.go b/config_center/apollo/listener.go index 44f39f2d36..2d75dc2374 100644 --- a/config_center/apollo/listener.go +++ b/config_center/apollo/listener.go @@ -18,13 +18,17 @@ package apollo import ( + "github.com/dubbogo/gost/log/logger" + "github.com/zouyx/agollo/v3" "github.com/zouyx/agollo/v3/storage" + "gopkg.in/yaml.v2" +) + +import ( "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" - "gopkg.in/yaml.v2" ) type apolloListener struct { diff --git a/config_center/file/listener.go b/config_center/file/listener.go index c147953b60..c68643532e 100644 --- a/config_center/file/listener.go +++ b/config_center/file/listener.go @@ -20,12 +20,18 @@ package file import ( "io/ioutil" "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" + + "github.com/fsnotify/fsnotify" +) +import ( "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" - "github.com/fsnotify/fsnotify" ) // CacheListener is file watcher diff --git a/config_center/nacos/client.go b/config_center/nacos/client.go index a153ebf3c4..52850115b1 100644 --- a/config_center/nacos/client.go +++ b/config_center/nacos/client.go @@ -20,14 +20,19 @@ package nacos import ( "sync" "time" +) +import ( nacosClient "github.com/dubbogo/gost/database/kv/nacos" - - "dubbo.apache.org/dubbo-go/v3/remoting/nacos" "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) +import ( + "dubbo.apache.org/dubbo-go/v3/remoting/nacos" +) + // NacosClient Nacos configClient type NacosClient struct { name string diff --git a/config_center/nacos/facade.go b/config_center/nacos/facade.go index a50864dbee..7b8ce8c0c6 100644 --- a/config_center/nacos/facade.go +++ b/config_center/nacos/facade.go @@ -19,12 +19,17 @@ package nacos import ( "sync" +) - "dubbo.apache.org/dubbo-go/v3/common" +import ( nacosClient "github.com/dubbogo/gost/database/kv/nacos" "github.com/dubbogo/gost/log/logger" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" +) + type nacosClientFacade interface { NacosClient() *nacosClient.NacosConfigClient SetNacosClient(*nacosClient.NacosConfigClient) diff --git a/config_center/nacos/impl.go b/config_center/nacos/impl.go index 580cc3538c..1a4ffa8bbc 100644 --- a/config_center/nacos/impl.go +++ b/config_center/nacos/impl.go @@ -20,20 +20,24 @@ package nacos import ( "strings" "sync" +) +import ( gxset "github.com/dubbogo/gost/container/set" - nacosClient "github.com/dubbogo/gost/database/kv/nacos" + "github.com/dubbogo/gost/log/logger" constant2 "github.com/nacos-group/nacos-sdk-go/common/constant" "github.com/nacos-group/nacos-sdk-go/vo" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/config_center/parser" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) const ( diff --git a/config_center/nacos/listener.go b/config_center/nacos/listener.go index c3afb51d74..ab335db648 100644 --- a/config_center/nacos/listener.go +++ b/config_center/nacos/listener.go @@ -19,15 +19,21 @@ package nacos import ( "context" +) - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/config_center" - "dubbo.apache.org/dubbo-go/v3/remoting" +import ( "github.com/dubbogo/gost/log/logger" + constant2 "github.com/nacos-group/nacos-sdk-go/common/constant" "github.com/nacos-group/nacos-sdk-go/vo" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/config_center" + "dubbo.apache.org/dubbo-go/v3/remoting" +) + func callback(listener config_center.ConfigurationListener, _, _, dataId, data string) { listener.Process(&config_center.ConfigChangeEvent{Key: dataId, Value: data, ConfigType: remoting.EventTypeUpdate}) } diff --git a/config_center/parser/configuration_parser.go b/config_center/parser/configuration_parser.go index 4920a70067..1f4b96083a 100644 --- a/config_center/parser/configuration_parser.go +++ b/config_center/parser/configuration_parser.go @@ -20,16 +20,23 @@ package parser import ( "strconv" "strings" +) + +import ( + "github.com/dubbogo/gost/log/logger" "github.com/magiconair/properties" - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "github.com/dubbogo/gost/log/logger" perrors "github.com/pkg/errors" + "gopkg.in/yaml.v2" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" +) + const ( ScopeApplication = "application" GeneralType = "general" diff --git a/config_center/zookeeper/impl.go b/config_center/zookeeper/impl.go index a81ec06bf9..538058cf1f 100644 --- a/config_center/zookeeper/impl.go +++ b/config_center/zookeeper/impl.go @@ -22,21 +22,25 @@ import ( "strconv" "strings" "sync" +) +import ( "github.com/dubbogo/go-zookeeper/zk" gxset "github.com/dubbogo/gost/container/set" - gxzookeeper "github.com/dubbogo/gost/database/kv/zk" + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/config_center/parser" "dubbo.apache.org/dubbo-go/v3/remoting/zookeeper" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) const ( diff --git a/filter/accesslog/filter.go b/filter/accesslog/filter.go index ed46e6369d..91b3898b1c 100644 --- a/filter/accesslog/filter.go +++ b/filter/accesslog/filter.go @@ -25,12 +25,17 @@ import ( "strings" "sync" "time" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/filter/active/filter.go b/filter/active/filter.go index 327ec0b995..78b8b62f25 100644 --- a/filter/active/filter.go +++ b/filter/active/filter.go @@ -21,13 +21,17 @@ import ( "context" "strconv" "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" +) +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - invocation2 "dubbo.apache.org/dubbo-go/v3/protocol/invocation" ) diff --git a/filter/adaptivesvc/filter.go b/filter/adaptivesvc/filter.go index 9b724b97b0..11c5015aac 100644 --- a/filter/adaptivesvc/filter.go +++ b/filter/adaptivesvc/filter.go @@ -23,14 +23,20 @@ import ( "fmt" "strings" "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" + + "github.com/pkg/errors" +) +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/filter/adaptivesvc/limiter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - "github.com/pkg/errors" ) var ( diff --git a/filter/adaptivesvc/limiter/utils.go b/filter/adaptivesvc/limiter/utils.go index 77376f78f4..f1fc3460b9 100644 --- a/filter/adaptivesvc/limiter/utils.go +++ b/filter/adaptivesvc/limiter/utils.go @@ -19,7 +19,9 @@ package limiter import ( "time" +) +import ( "github.com/dubbogo/gost/log/logger" ) diff --git a/filter/auth/provider_auth_filter.go b/filter/auth/provider_auth_filter.go index db8185ea1f..bf462d29be 100644 --- a/filter/auth/provider_auth_filter.go +++ b/filter/auth/provider_auth_filter.go @@ -20,12 +20,17 @@ package auth import ( "context" "sync" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) var ( diff --git a/filter/auth/sign_util.go b/filter/auth/sign_util.go index 76482a694c..97cd0a7a1d 100644 --- a/filter/auth/sign_util.go +++ b/filter/auth/sign_util.go @@ -24,7 +24,9 @@ import ( "encoding/json" "errors" "strings" +) +import ( "github.com/dubbogo/gost/log/logger" ) diff --git a/filter/exec_limit/filter.go b/filter/exec_limit/filter.go index 82eb215618..8d0967f2c9 100644 --- a/filter/exec_limit/filter.go +++ b/filter/exec_limit/filter.go @@ -47,13 +47,18 @@ import ( "strconv" "sync" "sync/atomic" +) - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/filter" +import ( "github.com/dubbogo/gost/log/logger" + "github.com/modern-go/concurrent" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/common/extension" + "dubbo.apache.org/dubbo-go/v3/filter" _ "dubbo.apache.org/dubbo-go/v3/filter/handler" "dubbo.apache.org/dubbo-go/v3/protocol" ) diff --git a/filter/generic/filter.go b/filter/generic/filter.go index b560239354..d385494c99 100644 --- a/filter/generic/filter.go +++ b/filter/generic/filter.go @@ -21,14 +21,19 @@ package generic import ( "context" "sync" +) + +import ( + hessian "github.com/apache/dubbo-go-hessian2" + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - hessian "github.com/apache/dubbo-go-hessian2" - "github.com/dubbogo/gost/log/logger" - invocation2 "dubbo.apache.org/dubbo-go/v3/protocol/invocation" ) diff --git a/filter/generic/generalizer/gson.go b/filter/generic/generalizer/gson.go index b1690d5226..1a2102e681 100644 --- a/filter/generic/generalizer/gson.go +++ b/filter/generic/generalizer/gson.go @@ -21,14 +21,20 @@ import ( "encoding/json" "reflect" "sync" +) +import ( hessian "github.com/apache/dubbo-go-hessian2" - "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/hessian2" "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) +import ( + "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/hessian2" +) + var ( jsonGeneralizer Generalizer jsonGeneralizerOnce sync.Once diff --git a/filter/generic/generalizer/map.go b/filter/generic/generalizer/map.go index bffec593c0..bbf55955b7 100644 --- a/filter/generic/generalizer/map.go +++ b/filter/generic/generalizer/map.go @@ -22,15 +22,22 @@ import ( "strings" "sync" "time" +) +import ( hessian "github.com/apache/dubbo-go-hessian2" - "github.com/mitchellh/mapstructure" - "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/hessian2" "github.com/dubbogo/gost/log/logger" + + "github.com/mitchellh/mapstructure" + perrors "github.com/pkg/errors" ) +import ( + "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/hessian2" +) + var ( mapGeneralizer Generalizer mapGeneralizerOnce sync.Once diff --git a/filter/generic/service_filter.go b/filter/generic/service_filter.go index faf291139d..c9a97c3c51 100644 --- a/filter/generic/service_filter.go +++ b/filter/generic/service_filter.go @@ -20,17 +20,22 @@ package generic import ( "context" "sync" +) +import ( hessian "github.com/apache/dubbo-go-hessian2" + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - invocation2 "dubbo.apache.org/dubbo-go/v3/protocol/invocation" ) diff --git a/filter/generic/util.go b/filter/generic/util.go index 244ec333bd..f6e5fc1aa3 100644 --- a/filter/generic/util.go +++ b/filter/generic/util.go @@ -19,11 +19,16 @@ package generic import ( "strings" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/filter/generic/generalizer" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) // isCallingToGenericService check if it calls to a generic service diff --git a/filter/graceful_shutdown/consumer_filter.go b/filter/graceful_shutdown/consumer_filter.go index b83dd0fef5..6ff12bf83d 100644 --- a/filter/graceful_shutdown/consumer_filter.go +++ b/filter/graceful_shutdown/consumer_filter.go @@ -20,13 +20,18 @@ package graceful_shutdown import ( "context" "sync" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) var ( diff --git a/filter/graceful_shutdown/provider_filter.go b/filter/graceful_shutdown/provider_filter.go index b1745c7e3b..a883d05d7e 100644 --- a/filter/graceful_shutdown/provider_filter.go +++ b/filter/graceful_shutdown/provider_filter.go @@ -20,13 +20,18 @@ package graceful_shutdown import ( "context" "sync" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) var ( diff --git a/filter/handler/rejected_execution_handler_only_log.go b/filter/handler/rejected_execution_handler_only_log.go index e918d3a2bb..445493b9ad 100644 --- a/filter/handler/rejected_execution_handler_only_log.go +++ b/filter/handler/rejected_execution_handler_only_log.go @@ -19,13 +19,18 @@ package handler import ( "sync" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/filter/hystrix/filter.go b/filter/hystrix/filter.go index b4b0b6e77f..db102ab70c 100644 --- a/filter/hystrix/filter.go +++ b/filter/hystrix/filter.go @@ -24,17 +24,24 @@ import ( "reflect" "regexp" "sync" +) +import ( "github.com/afex/hystrix-go/hystrix" + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" + + "gopkg.in/yaml.v2" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - "gopkg.in/yaml.v2" ) const ( diff --git a/filter/seata/filter.go b/filter/seata/filter.go index a2d470499b..93d6baf260 100644 --- a/filter/seata/filter.go +++ b/filter/seata/filter.go @@ -22,12 +22,17 @@ import ( "context" "strings" "sync" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/filter/sentinel/filter.go b/filter/sentinel/filter.go index 627f94c53e..fdedf8dba2 100644 --- a/filter/sentinel/filter.go +++ b/filter/sentinel/filter.go @@ -26,16 +26,22 @@ import ( "fmt" "strings" "sync" +) + +import ( + sentinel "github.com/alibaba/sentinel-golang/api" + "github.com/alibaba/sentinel-golang/core/base" + "github.com/alibaba/sentinel-golang/logging" + + "github.com/dubbogo/gost/log/logger" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - sentinel "github.com/alibaba/sentinel-golang/api" - "github.com/alibaba/sentinel-golang/core/base" - "github.com/alibaba/sentinel-golang/logging" - "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/filter/tps/filter.go b/filter/tps/filter.go index 5fa85811f1..1cc822bb65 100644 --- a/filter/tps/filter.go +++ b/filter/tps/filter.go @@ -34,14 +34,17 @@ package tps import ( "context" "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" +) +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" - "github.com/dubbogo/gost/log/logger" - _ "dubbo.apache.org/dubbo-go/v3/filter/handler" - _ "dubbo.apache.org/dubbo-go/v3/filter/tps/limiter" "dubbo.apache.org/dubbo-go/v3/protocol" ) diff --git a/filter/tps/limiter/method_service.go b/filter/tps/limiter/method_service.go index 4ffc493b6a..09b5918e06 100644 --- a/filter/tps/limiter/method_service.go +++ b/filter/tps/limiter/method_service.go @@ -21,14 +21,20 @@ import ( "fmt" "strconv" "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" + + "github.com/modern-go/concurrent" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - "github.com/modern-go/concurrent" ) const ( diff --git a/filter/xds/cb/filter.go b/filter/xds/cb/filter.go index 39cf3aad66..841cc1493f 100644 --- a/filter/xds/cb/filter.go +++ b/filter/xds/cb/filter.go @@ -19,7 +19,13 @@ package cb import ( "context" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" @@ -28,7 +34,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/remoting/xds" "dubbo.apache.org/dubbo-go/v3/xds/client" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" - "github.com/dubbogo/gost/log/logger" ) // this should be executed before users set their own Tracer diff --git a/metadata/mapping/metadata/service_name_mapping.go b/metadata/mapping/metadata/service_name_mapping.go index be2950f9c1..ae934ae481 100644 --- a/metadata/mapping/metadata/service_name_mapping.go +++ b/metadata/mapping/metadata/service_name_mapping.go @@ -19,9 +19,16 @@ package metadata import ( "sync" +) +import ( gxset "github.com/dubbogo/gost/container/set" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" @@ -29,8 +36,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/config/instance" "dubbo.apache.org/dubbo-go/v3/metadata/mapping" "dubbo.apache.org/dubbo-go/v3/metadata/report" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) const ( diff --git a/metadata/report/delegate/delegate_report.go b/metadata/report/delegate/delegate_report.go index 299c95bef9..70a12ac226 100644 --- a/metadata/report/delegate/delegate_report.go +++ b/metadata/report/delegate/delegate_report.go @@ -22,17 +22,24 @@ import ( "runtime/debug" "sync" "time" +) + +import ( + "github.com/dubbogo/gost/log/logger" "github.com/go-co-op/gocron" + perrors "github.com/pkg/errors" + + "go.uber.org/atomic" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config/instance" "dubbo.apache.org/dubbo-go/v3/metadata/definition" "dubbo.apache.org/dubbo-go/v3/metadata/identifier" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - "go.uber.org/atomic" ) const ( diff --git a/metadata/report/delegate/delegate_report_test.go b/metadata/report/delegate/delegate_report_test.go index b88d2d5c9c..060cf161b9 100644 --- a/metadata/report/delegate/delegate_report_test.go +++ b/metadata/report/delegate/delegate_report_test.go @@ -21,15 +21,22 @@ import ( "fmt" "testing" "time" +) + +import ( + "github.com/dubbogo/gost/log/logger" + "github.com/stretchr/testify/assert" + + "go.uber.org/atomic" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config/instance" "dubbo.apache.org/dubbo-go/v3/metadata/definition" "dubbo.apache.org/dubbo-go/v3/metadata/identifier" - "github.com/dubbogo/gost/log/logger" - "github.com/stretchr/testify/assert" - "go.uber.org/atomic" ) func TestMetadataReport_MetadataReportRetry(t *testing.T) { diff --git a/metadata/report/etcd/report.go b/metadata/report/etcd/report.go index 9aa3ca873d..6d066b17ff 100644 --- a/metadata/report/etcd/report.go +++ b/metadata/report/etcd/report.go @@ -20,19 +20,23 @@ package etcd import ( "encoding/json" "strings" +) +import ( gxset "github.com/dubbogo/gost/container/set" - gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/metadata/identifier" "dubbo.apache.org/dubbo-go/v3/metadata/report" "dubbo.apache.org/dubbo-go/v3/metadata/report/factory" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) const DEFAULT_ROOT = "dubbo" diff --git a/metadata/report/nacos/report.go b/metadata/report/nacos/report.go index 219e027353..655b577040 100644 --- a/metadata/report/nacos/report.go +++ b/metadata/report/nacos/report.go @@ -21,12 +21,19 @@ import ( "encoding/json" "net/url" "strings" +) +import ( gxset "github.com/dubbogo/gost/container/set" - nacosClient "github.com/dubbogo/gost/database/kv/nacos" + "github.com/dubbogo/gost/log/logger" + "github.com/nacos-group/nacos-sdk-go/vo" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" @@ -34,8 +41,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/metadata/report" "dubbo.apache.org/dubbo-go/v3/metadata/report/factory" "dubbo.apache.org/dubbo-go/v3/remoting/nacos" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) func init() { diff --git a/metadata/report/zookeeper/report.go b/metadata/report/zookeeper/report.go index c3bafb1273..e93c9153a9 100644 --- a/metadata/report/zookeeper/report.go +++ b/metadata/report/zookeeper/report.go @@ -20,19 +20,23 @@ package zookeeper import ( "encoding/json" "strings" +) +import ( "github.com/dubbogo/go-zookeeper/zk" gxset "github.com/dubbogo/gost/container/set" + gxzookeeper "github.com/dubbogo/gost/database/kv/zk" + "github.com/dubbogo/gost/log/logger" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/metadata/identifier" "dubbo.apache.org/dubbo-go/v3/metadata/report" "dubbo.apache.org/dubbo-go/v3/metadata/report/factory" - gxzookeeper "github.com/dubbogo/gost/database/kv/zk" - "github.com/dubbogo/gost/log/logger" ) var emptyStrSlice = make([]string, 0) diff --git a/metadata/service/exporter/configurable/exporter.go b/metadata/service/exporter/configurable/exporter.go index 6e78b28aab..b8e17422ec 100644 --- a/metadata/service/exporter/configurable/exporter.go +++ b/metadata/service/exporter/configurable/exporter.go @@ -19,19 +19,21 @@ package configurable import ( "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config" - "github.com/dubbogo/gost/log/logger" - _ "dubbo.apache.org/dubbo-go/v3/metadata/mapping/metadata" "dubbo.apache.org/dubbo-go/v3/metadata/service" "dubbo.apache.org/dubbo-go/v3/metadata/service/exporter" - _ "dubbo.apache.org/dubbo-go/v3/metadata/service/remote" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" ) diff --git a/metadata/service/exporter/configurable/exporter_test.go b/metadata/service/exporter/configurable/exporter_test.go index 12bb401e10..aeb260cfde 100644 --- a/metadata/service/exporter/configurable/exporter_test.go +++ b/metadata/service/exporter/configurable/exporter_test.go @@ -19,19 +19,20 @@ package configurable import ( "testing" +) - "dubbo.apache.org/dubbo-go/v3/common" +import ( "github.com/stretchr/testify/assert" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" - _ "dubbo.apache.org/dubbo-go/v3/metrics/prometheus" - _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo" + _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" "dubbo.apache.org/dubbo-go/v3/remoting/getty" ) diff --git a/metadata/service/local/metadata_service_proxy_factory.go b/metadata/service/local/metadata_service_proxy_factory.go index 090ca19f74..417cc4cf8d 100644 --- a/metadata/service/local/metadata_service_proxy_factory.go +++ b/metadata/service/local/metadata_service_proxy_factory.go @@ -20,13 +20,18 @@ package local import ( "encoding/json" "sync" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/metadata/service" "dubbo.apache.org/dubbo-go/v3/registry" - "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/metadata/service/local/service.go b/metadata/service/local/service.go index 9696314ea4..2b2e6ac88a 100644 --- a/metadata/service/local/service.go +++ b/metadata/service/local/service.go @@ -20,15 +20,21 @@ package local import ( "sort" "sync" +) + +import ( + "github.com/Workiva/go-datastructures/slice/skip" + + "github.com/dubbogo/gost/log/logger" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/metadata/definition" "dubbo.apache.org/dubbo-go/v3/metadata/service" - "github.com/Workiva/go-datastructures/slice/skip" - "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/metadata/service/local/service_proxy.go b/metadata/service/local/service_proxy.go index dcee0887d0..711058d8e8 100644 --- a/metadata/service/local/service_proxy.go +++ b/metadata/service/local/service_proxy.go @@ -20,12 +20,17 @@ package local import ( "context" "reflect" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" - "github.com/dubbogo/gost/log/logger" ) // MetadataServiceProxy actually is a RPC stub which will only be used by client-side. diff --git a/metadata/service/remote/service.go b/metadata/service/remote/service.go index 30dc0bf6a4..aaf6aae629 100644 --- a/metadata/service/remote/service.go +++ b/metadata/service/remote/service.go @@ -19,7 +19,15 @@ package remote import ( "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" + + "go.uber.org/atomic" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" @@ -29,8 +37,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/metadata/service" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" "dubbo.apache.org/dubbo-go/v3/registry" - "github.com/dubbogo/gost/log/logger" - "go.uber.org/atomic" ) type MetadataService struct { diff --git a/metadata/service/remote/service_test.go b/metadata/service/remote/service_test.go index 7c1331ad37..ae1eeea3ef 100644 --- a/metadata/service/remote/service_test.go +++ b/metadata/service/remote/service_test.go @@ -20,7 +20,16 @@ package remote import ( "fmt" "testing" +) + +import ( + gxset "github.com/dubbogo/gost/container/set" + "github.com/dubbogo/gost/log/logger" + + "github.com/stretchr/testify/assert" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config/instance" @@ -29,9 +38,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/metadata/report" "dubbo.apache.org/dubbo-go/v3/metadata/report/factory" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" - gxset "github.com/dubbogo/gost/container/set" - "github.com/dubbogo/gost/log/logger" - "github.com/stretchr/testify/assert" ) var ( diff --git a/metrics/prometheus/reporter.go b/metrics/prometheus/reporter.go index 9f475a95a4..231a2c8832 100644 --- a/metrics/prometheus/reporter.go +++ b/metrics/prometheus/reporter.go @@ -24,17 +24,23 @@ import ( "strings" "sync" "time" +) +import ( ocprom "contrib.go.opencensus.io/exporter/prometheus" + + "github.com/dubbogo/gost/log/logger" + "github.com/prometheus/client_golang/prometheus" + prom "github.com/prometheus/client_golang/prometheus" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/metrics" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - prom "github.com/prometheus/client_golang/prometheus" ) const ( diff --git a/protocol/dubbo/dubbo_codec.go b/protocol/dubbo/dubbo_codec.go index ec62040178..92f7132bf8 100644 --- a/protocol/dubbo/dubbo_codec.go +++ b/protocol/dubbo/dubbo_codec.go @@ -21,15 +21,20 @@ import ( "bytes" "strconv" "time" +) +import ( hessian "github.com/apache/dubbo-go-hessian2" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/protocol" - "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl" "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/protocol" + "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl" invct "dubbo.apache.org/dubbo-go/v3/protocol/invocation" "dubbo.apache.org/dubbo-go/v3/remoting" ) diff --git a/protocol/dubbo/dubbo_exporter.go b/protocol/dubbo/dubbo_exporter.go index 12a75b7287..1f4008438e 100644 --- a/protocol/dubbo/dubbo_exporter.go +++ b/protocol/dubbo/dubbo_exporter.go @@ -19,11 +19,16 @@ package dubbo import ( "sync" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) // DubboExporter is dubbo service exporter. diff --git a/protocol/dubbo/dubbo_invoker.go b/protocol/dubbo/dubbo_invoker.go index a24f25c0a4..df16807eed 100644 --- a/protocol/dubbo/dubbo_invoker.go +++ b/protocol/dubbo/dubbo_invoker.go @@ -23,14 +23,19 @@ import ( "strings" "sync" "time" +) + +import ( + "github.com/dubbogo/gost/log/logger" + "github.com/opentracing/opentracing-go" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - "github.com/opentracing/opentracing-go" - invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation" "dubbo.apache.org/dubbo-go/v3/remoting" ) diff --git a/protocol/dubbo/dubbo_protocol.go b/protocol/dubbo/dubbo_protocol.go index f879b2639c..573afa9294 100644 --- a/protocol/dubbo/dubbo_protocol.go +++ b/protocol/dubbo/dubbo_protocol.go @@ -22,7 +22,15 @@ import ( "fmt" "sync" "time" +) + +import ( + "github.com/dubbogo/gost/log/logger" + + "github.com/opentracing/opentracing-go" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" @@ -30,8 +38,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/protocol/invocation" "dubbo.apache.org/dubbo-go/v3/remoting" "dubbo.apache.org/dubbo-go/v3/remoting/getty" - "github.com/dubbogo/gost/log/logger" - "github.com/opentracing/opentracing-go" ) const ( diff --git a/protocol/dubbo/dubbo_protocol_test.go b/protocol/dubbo/dubbo_protocol_test.go index 1b3358b896..3ccbcd1582 100644 --- a/protocol/dubbo/dubbo_protocol_test.go +++ b/protocol/dubbo/dubbo_protocol_test.go @@ -19,13 +19,18 @@ package dubbo import ( "testing" +) +import ( + "github.com/stretchr/testify/assert" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" "dubbo.apache.org/dubbo-go/v3/remoting/getty" - "github.com/stretchr/testify/assert" ) const ( diff --git a/protocol/dubbo/hessian2/hessian_request.go b/protocol/dubbo/hessian2/hessian_request.go index 797c01645e..608b03fdc5 100644 --- a/protocol/dubbo/hessian2/hessian_request.go +++ b/protocol/dubbo/hessian2/hessian_request.go @@ -22,10 +22,13 @@ import ( "strconv" "strings" "time" +) +import ( hessian "github.com/apache/dubbo-go-hessian2" "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) diff --git a/protocol/dubbo/hessian2/hessian_response.go b/protocol/dubbo/hessian2/hessian_response.go index e5381be402..2dc5f376f0 100644 --- a/protocol/dubbo/hessian2/hessian_response.go +++ b/protocol/dubbo/hessian2/hessian_response.go @@ -23,11 +23,14 @@ import ( "reflect" "strconv" "strings" +) +import ( hessian "github.com/apache/dubbo-go-hessian2" "github.com/apache/dubbo-go-hessian2/java_exception" "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) diff --git a/protocol/dubbo/impl/codec.go b/protocol/dubbo/impl/codec.go index a89741c886..f629f9133c 100644 --- a/protocol/dubbo/impl/codec.go +++ b/protocol/dubbo/impl/codec.go @@ -20,15 +20,21 @@ package impl import ( "bufio" "encoding/binary" +) +import ( hessian "github.com/apache/dubbo-go-hessian2" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/remoting" "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/remoting" +) + type ProtocolCodec struct { reader *bufio.Reader pkgType PackageType diff --git a/protocol/dubbo/impl/hessian.go b/protocol/dubbo/impl/hessian.go index 438bf94358..df90bd4133 100644 --- a/protocol/dubbo/impl/hessian.go +++ b/protocol/dubbo/impl/hessian.go @@ -23,16 +23,22 @@ import ( "strconv" "strings" "time" +) +import ( hessian "github.com/apache/dubbo-go-hessian2" "github.com/apache/dubbo-go-hessian2/java_exception" - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" +) + type HessianSerializer struct{} func (h HessianSerializer) Marshal(p DubboPackage) ([]byte, error) { diff --git a/protocol/dubbo3/dubbo3_exporter.go b/protocol/dubbo3/dubbo3_exporter.go index 2a96be2513..3b997b089d 100644 --- a/protocol/dubbo3/dubbo3_exporter.go +++ b/protocol/dubbo3/dubbo3_exporter.go @@ -19,12 +19,18 @@ package dubbo3 import ( "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" + + tripleConstant "github.com/dubbogo/triple/pkg/common/constant" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - tripleConstant "github.com/dubbogo/triple/pkg/common/constant" ) // DubboExporter is dubbo3 service exporter. diff --git a/protocol/dubbo3/dubbo3_invoker.go b/protocol/dubbo3/dubbo3_invoker.go index 4255cb0e5d..9e8801ed4a 100644 --- a/protocol/dubbo3/dubbo3_invoker.go +++ b/protocol/dubbo3/dubbo3_invoker.go @@ -24,19 +24,23 @@ import ( "strings" "sync" "time" +) + +import ( + "github.com/dubbogo/gost/log/logger" "github.com/dubbogo/grpc-go/metadata" tripleConstant "github.com/dubbogo/triple/pkg/common/constant" + triConfig "github.com/dubbogo/triple/pkg/config" + "github.com/dubbogo/triple/pkg/triple" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - triConfig "github.com/dubbogo/triple/pkg/config" - "github.com/dubbogo/triple/pkg/triple" - invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation" ) diff --git a/protocol/dubbo3/dubbo3_protocol.go b/protocol/dubbo3/dubbo3_protocol.go index c5e41eb132..6a6e96e265 100644 --- a/protocol/dubbo3/dubbo3_protocol.go +++ b/protocol/dubbo3/dubbo3_protocol.go @@ -23,21 +23,26 @@ import ( "reflect" "strconv" "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" "github.com/dubbogo/grpc-go" "github.com/dubbogo/grpc-go/metadata" tripleConstant "github.com/dubbogo/triple/pkg/common/constant" + triConfig "github.com/dubbogo/triple/pkg/config" + "github.com/dubbogo/triple/pkg/triple" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" - "github.com/dubbogo/gost/log/logger" - triConfig "github.com/dubbogo/triple/pkg/config" - "github.com/dubbogo/triple/pkg/triple" ) var protocolOnce sync.Once diff --git a/protocol/dubbo3/internal/server.go b/protocol/dubbo3/internal/server.go index 12a4e2373b..055bf1b9ba 100644 --- a/protocol/dubbo3/internal/server.go +++ b/protocol/dubbo3/internal/server.go @@ -19,16 +19,18 @@ package internal import ( "context" +) - "dubbo.apache.org/dubbo-go/v3/common" +import ( log "github.com/dubbogo/gost/log/logger" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/config" - _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" - _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl" - _ "dubbo.apache.org/dubbo-go/v3/metrics/prometheus" + _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" ) // server is used to implement helloworld.GreeterServer. diff --git a/protocol/grpc/client.go b/protocol/grpc/client.go index 3d55b2fb99..f316d931c1 100644 --- a/protocol/grpc/client.go +++ b/protocol/grpc/client.go @@ -22,17 +22,26 @@ import ( "strconv" "sync" "time" +) - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/config" +import ( "github.com/dubbogo/gost/log/logger" + "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc" + "github.com/opentracing/opentracing-go" + "google.golang.org/grpc" + "gopkg.in/yaml.v2" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/config" +) + var clientConf *ClientConfig var clientConfInitOnce sync.Once diff --git a/protocol/grpc/grpc_exporter.go b/protocol/grpc/grpc_exporter.go index e50dc451b9..464ce39f1f 100644 --- a/protocol/grpc/grpc_exporter.go +++ b/protocol/grpc/grpc_exporter.go @@ -19,11 +19,16 @@ package grpc import ( "sync" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) // nolint diff --git a/protocol/grpc/grpc_invoker.go b/protocol/grpc/grpc_invoker.go index e14da8f790..6e4c381023 100644 --- a/protocol/grpc/grpc_invoker.go +++ b/protocol/grpc/grpc_invoker.go @@ -21,15 +21,23 @@ import ( "context" "reflect" "sync" +) - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/protocol" +import ( hessian2 "github.com/apache/dubbo-go-hessian2" + "github.com/dubbogo/gost/log/logger" + "github.com/pkg/errors" + "google.golang.org/grpc/connectivity" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/protocol" +) + var errNoReply = errors.New("request need @response") // nolint diff --git a/protocol/grpc/grpc_protocol.go b/protocol/grpc/grpc_protocol.go index df18646e76..5521109f4d 100644 --- a/protocol/grpc/grpc_protocol.go +++ b/protocol/grpc/grpc_protocol.go @@ -20,12 +20,17 @@ package grpc import ( "strconv" "sync" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/protocol/grpc/internal/helloworld/server.go b/protocol/grpc/internal/helloworld/server.go index 176bc3a666..d855c0a26b 100644 --- a/protocol/grpc/internal/helloworld/server.go +++ b/protocol/grpc/internal/helloworld/server.go @@ -20,10 +20,12 @@ package helloworld import ( "context" "net" +) - "google.golang.org/grpc" - +import ( log "github.com/dubbogo/gost/log/logger" + + "google.golang.org/grpc" ) // server is used to implement helloworld.GreeterServer. diff --git a/protocol/grpc/internal/routeguide/client.go b/protocol/grpc/internal/routeguide/client.go index 2b2382af48..542667ef5c 100644 --- a/protocol/grpc/internal/routeguide/client.go +++ b/protocol/grpc/internal/routeguide/client.go @@ -21,11 +21,16 @@ import ( "io" "math/rand" "time" +) - "dubbo.apache.org/dubbo-go/v3/config" +import ( log "github.com/dubbogo/gost/log/logger" ) +import ( + "dubbo.apache.org/dubbo-go/v3/config" +) + func init() { config.SetConsumerServiceByInterfaceName("io.grpc.examples.helloworld.GreeterGrpc$RouteGuide", &RouteGuideClientImpl{}) config.SetConsumerService(&RouteGuideClientImpl{}) diff --git a/protocol/grpc/internal/routeguide/server.go b/protocol/grpc/internal/routeguide/server.go index d4aa757073..77a36fd3b1 100644 --- a/protocol/grpc/internal/routeguide/server.go +++ b/protocol/grpc/internal/routeguide/server.go @@ -26,11 +26,14 @@ import ( "net" "sync" "time" +) + +import ( + log "github.com/dubbogo/gost/log/logger" "github.com/golang/protobuf/proto" - "google.golang.org/grpc" - log "github.com/dubbogo/gost/log/logger" + "google.golang.org/grpc" ) type routeGuideServer struct { diff --git a/protocol/grpc/server.go b/protocol/grpc/server.go index 5f40e83373..d938af857f 100644 --- a/protocol/grpc/server.go +++ b/protocol/grpc/server.go @@ -22,17 +22,25 @@ import ( "net" "sync" "time" +) - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/config" - "dubbo.apache.org/dubbo-go/v3/protocol" +import ( "github.com/dubbogo/gost/log/logger" + "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc" + "github.com/opentracing/opentracing-go" + "google.golang.org/grpc" "google.golang.org/grpc/reflection" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/config" + "dubbo.apache.org/dubbo-go/v3/protocol" +) + // DubboGrpcService is gRPC service type DubboGrpcService interface { // SetProxyImpl sets proxy. diff --git a/protocol/invoker.go b/protocol/invoker.go index 422d7f425e..ecd36cd375 100644 --- a/protocol/invoker.go +++ b/protocol/invoker.go @@ -20,14 +20,20 @@ package protocol import ( "context" "fmt" +) + +import ( + "github.com/dubbogo/gost/log/logger" perrors "github.com/pkg/errors" - "dubbo.apache.org/dubbo-go/v3/common" - "github.com/dubbogo/gost/log/logger" uatomic "go.uber.org/atomic" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" +) + var ( ErrClientClosed = perrors.New("remoting client has closed") ErrNoReply = perrors.New("request need @response") diff --git a/protocol/jsonrpc/http.go b/protocol/jsonrpc/http.go index 6606c75234..2a62c46179 100644 --- a/protocol/jsonrpc/http.go +++ b/protocol/jsonrpc/http.go @@ -30,13 +30,19 @@ import ( "strings" "sync/atomic" "time" +) + +import ( + "github.com/dubbogo/gost/log/logger" "github.com/opentracing/opentracing-go" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) // Request is HTTP protocol request diff --git a/protocol/jsonrpc/http_test.go b/protocol/jsonrpc/http_test.go index f62d6841a4..d214b1b49a 100644 --- a/protocol/jsonrpc/http_test.go +++ b/protocol/jsonrpc/http_test.go @@ -19,7 +19,9 @@ package jsonrpc import ( "context" +) +import ( perrors "github.com/pkg/errors" ) diff --git a/protocol/jsonrpc/jsonrpc_exporter.go b/protocol/jsonrpc/jsonrpc_exporter.go index 3a686f295c..6cdfb46c52 100644 --- a/protocol/jsonrpc/jsonrpc_exporter.go +++ b/protocol/jsonrpc/jsonrpc_exporter.go @@ -19,11 +19,16 @@ package jsonrpc import ( "sync" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) // JsonrpcExporter is JSON RPC exporter and extends from base invoker. diff --git a/protocol/jsonrpc/jsonrpc_invoker.go b/protocol/jsonrpc/jsonrpc_invoker.go index e4e59f4a4a..2e28362e05 100644 --- a/protocol/jsonrpc/jsonrpc_invoker.go +++ b/protocol/jsonrpc/jsonrpc_invoker.go @@ -19,12 +19,16 @@ package jsonrpc import ( "context" +) + +import ( + "github.com/dubbogo/gost/log/logger" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation" ) diff --git a/protocol/jsonrpc/jsonrpc_protocol.go b/protocol/jsonrpc/jsonrpc_protocol.go index 3bb79fa2ed..16ca254233 100644 --- a/protocol/jsonrpc/jsonrpc_protocol.go +++ b/protocol/jsonrpc/jsonrpc_protocol.go @@ -21,13 +21,18 @@ import ( "strings" "sync" "time" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/protocol/jsonrpc/server.go b/protocol/jsonrpc/server.go index 392385d685..4470cb277a 100644 --- a/protocol/jsonrpc/server.go +++ b/protocol/jsonrpc/server.go @@ -29,14 +29,20 @@ import ( "runtime/debug" "sync" "time" +) + +import ( + "github.com/dubbogo/gost/log/logger" "github.com/opentracing/opentracing-go" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) // A value sent as a placeholder for the server's response value when the server diff --git a/protocol/protocol.go b/protocol/protocol.go index 29ddd6f72a..abd83c9962 100644 --- a/protocol/protocol.go +++ b/protocol/protocol.go @@ -19,11 +19,16 @@ package protocol import ( "sync" +) - "dubbo.apache.org/dubbo-go/v3/common" +import ( "github.com/dubbogo/gost/log/logger" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" +) + // Protocol is the interface that wraps the basic Export、 Refer and Destroy method. // // Export method is to export service for remote invocation diff --git a/protocol/protocolwrapper/protocol_filter_wrapper.go b/protocol/protocolwrapper/protocol_filter_wrapper.go index 6d00debb4b..6c1023a0e9 100644 --- a/protocol/protocolwrapper/protocol_filter_wrapper.go +++ b/protocol/protocolwrapper/protocol_filter_wrapper.go @@ -20,13 +20,18 @@ package protocolwrapper import ( "context" "strings" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/protocol/protocolwrapper/protocol_filter_wrapper_test.go b/protocol/protocolwrapper/protocol_filter_wrapper_test.go index 89f2b9a886..df6d948023 100644 --- a/protocol/protocolwrapper/protocol_filter_wrapper_test.go +++ b/protocol/protocolwrapper/protocol_filter_wrapper_test.go @@ -21,14 +21,20 @@ import ( "context" "net/url" "testing" +) + +import ( + "github.com/dubbogo/gost/log/logger" + + "github.com/stretchr/testify/assert" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/filter" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" - "github.com/stretchr/testify/assert" ) const mockFilterKey = "mockEcho" diff --git a/protocol/rest/config/reader/rest_config_reader.go b/protocol/rest/config/reader/rest_config_reader.go index 6365d89814..57565c92d7 100644 --- a/protocol/rest/config/reader/rest_config_reader.go +++ b/protocol/rest/config/reader/rest_config_reader.go @@ -21,14 +21,21 @@ import ( "bytes" "strconv" "strings" +) + +import ( + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + + "gopkg.in/yaml.v2" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config/interfaces" "dubbo.apache.org/dubbo-go/v3/protocol/rest/config" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - "gopkg.in/yaml.v2" ) const REST = "rest" diff --git a/protocol/rest/config/reader/rest_config_reader_test.go b/protocol/rest/config/reader/rest_config_reader_test.go index de482821e1..71f8a0b126 100644 --- a/protocol/rest/config/reader/rest_config_reader_test.go +++ b/protocol/rest/config/reader/rest_config_reader_test.go @@ -20,12 +20,18 @@ package reader import ( "bytes" "testing" +) - "dubbo.apache.org/dubbo-go/v3/protocol/rest/config" +import ( "github.com/dubbogo/gost/encoding/yaml" + "github.com/stretchr/testify/assert" ) +import ( + "dubbo.apache.org/dubbo-go/v3/protocol/rest/config" +) + func TestRestConfigReaderReadConsumerConfig(t *testing.T) { bs, err := yaml.LoadYMLConfig("./testdata/consumer_config.yml") assert.NoError(t, err) diff --git a/protocol/rest/rest_exporter.go b/protocol/rest/rest_exporter.go index 81ae543bfe..9bc27da2db 100644 --- a/protocol/rest/rest_exporter.go +++ b/protocol/rest/rest_exporter.go @@ -19,11 +19,16 @@ package rest import ( "sync" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol" - "github.com/dubbogo/gost/log/logger" ) // nolint diff --git a/protocol/rest/rest_protocol.go b/protocol/rest/rest_protocol.go index cdf223a31b..303b453533 100644 --- a/protocol/rest/rest_protocol.go +++ b/protocol/rest/rest_protocol.go @@ -20,21 +20,22 @@ package rest import ( "sync" "time" +) + +import ( + "github.com/dubbogo/gost/log/logger" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/rest/client" - "github.com/dubbogo/gost/log/logger" - _ "dubbo.apache.org/dubbo-go/v3/protocol/rest/client/client_impl" - rest_config "dubbo.apache.org/dubbo-go/v3/protocol/rest/config" - _ "dubbo.apache.org/dubbo-go/v3/protocol/rest/config/reader" "dubbo.apache.org/dubbo-go/v3/protocol/rest/server" - _ "dubbo.apache.org/dubbo-go/v3/protocol/rest/server/server_impl" ) diff --git a/protocol/rest/server/rest_server.go b/protocol/rest/server/rest_server.go index 09c71c8502..a41aaf937a 100644 --- a/protocol/rest/server/rest_server.go +++ b/protocol/rest/server/rest_server.go @@ -23,13 +23,18 @@ import ( "net/http" "reflect" "strconv" +) - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/protocol" - "dubbo.apache.org/dubbo-go/v3/protocol/invocation" +import ( "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/protocol" + "dubbo.apache.org/dubbo-go/v3/protocol/invocation" rest_config "dubbo.apache.org/dubbo-go/v3/protocol/rest/config" ) diff --git a/protocol/rest/server/server_impl/go_restful_server.go b/protocol/rest/server/server_impl/go_restful_server.go index a9184f4364..642d28b67a 100644 --- a/protocol/rest/server/server_impl/go_restful_server.go +++ b/protocol/rest/server/server_impl/go_restful_server.go @@ -24,16 +24,22 @@ import ( "net/http" "strings" "time" +) + +import ( + "github.com/dubbogo/gost/log/logger" "github.com/emicklei/go-restful/v3" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol/rest/config" "dubbo.apache.org/dubbo-go/v3/protocol/rest/server" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) func init() { diff --git a/protocol/rpc_status.go b/protocol/rpc_status.go index 821fe164d9..4452d75f1b 100644 --- a/protocol/rpc_status.go +++ b/protocol/rpc_status.go @@ -21,13 +21,19 @@ import ( "sync" "sync/atomic" "time" +) - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" +import ( "github.com/dubbogo/gost/log/logger" + uberAtomic "go.uber.org/atomic" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" +) + var ( methodStatistics sync.Map // url -> { methodName : RPCStatus} serviceStatistic sync.Map // url -> RPCStatus diff --git a/proxy/proxy.go b/proxy/proxy.go index ce2ea7cdfb..72da5904f7 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -22,15 +22,20 @@ import ( "errors" "reflect" "sync" +) +import ( "github.com/apache/dubbo-go-hessian2/java_exception" - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/protocol" "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/protocol" invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation" ) diff --git a/proxy/proxy_factory/default.go b/proxy/proxy_factory/default.go index 2c949846e4..d35d02cc14 100644 --- a/proxy/proxy_factory/default.go +++ b/proxy/proxy_factory/default.go @@ -21,14 +21,20 @@ import ( "context" "reflect" "strings" +) + +import ( + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/proxy" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) func init() { diff --git a/proxy/proxy_factory/pass_through.go b/proxy/proxy_factory/pass_through.go index 5b5fa74f68..5739e12e3a 100644 --- a/proxy/proxy_factory/pass_through.go +++ b/proxy/proxy_factory/pass_through.go @@ -20,14 +20,20 @@ package proxy_factory import ( "context" "reflect" +) + +import ( + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/proxy" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) func init() { diff --git a/registry/base_configuration_listener.go b/registry/base_configuration_listener.go index 484fe0ac7e..88f1867645 100644 --- a/registry/base_configuration_listener.go +++ b/registry/base_configuration_listener.go @@ -17,14 +17,18 @@ package registry +import ( + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" +) + import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/config" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) // nolint diff --git a/registry/base_registry.go b/registry/base_registry.go index 80a54bf075..569236e33a 100644 --- a/registry/base_registry.go +++ b/registry/base_registry.go @@ -25,13 +25,19 @@ import ( "strings" "sync" "time" +) - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" +import ( "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" +) + const ( RegistryConnDelay = 3 // connection delay MaxWaitInterval = 3 * time.Second // max wait interval diff --git a/registry/directory/directory.go b/registry/directory/directory.go index dd91860a57..bef438b63c 100644 --- a/registry/directory/directory.go +++ b/registry/directory/directory.go @@ -22,7 +22,15 @@ import ( "net/url" "os" "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/cluster/directory" "dubbo.apache.org/dubbo-go/v3/cluster/directory/base" "dubbo.apache.org/dubbo-go/v3/cluster/directory/static" @@ -32,9 +40,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/config_center" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - _ "dubbo.apache.org/dubbo-go/v3/config_center/configurator" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper" diff --git a/registry/etcdv3/listener.go b/registry/etcdv3/listener.go index f602eca7f6..8eefd95240 100644 --- a/registry/etcdv3/listener.go +++ b/registry/etcdv3/listener.go @@ -20,15 +20,20 @@ package etcdv3 import ( "strings" "sync" +) +import ( gxchan "github.com/dubbogo/gost/container/chan" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) type dataListener struct { diff --git a/registry/etcdv3/registry.go b/registry/etcdv3/registry.go index 173614e8c5..9a86bef0b3 100644 --- a/registry/etcdv3/registry.go +++ b/registry/etcdv3/registry.go @@ -22,16 +22,21 @@ import ( "path" "strings" "sync" +) +import ( gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting/etcdv3" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) const ( diff --git a/registry/etcdv3/service_discovery.go b/registry/etcdv3/service_discovery.go index ba443e12bd..59cb096c9a 100644 --- a/registry/etcdv3/service_discovery.go +++ b/registry/etcdv3/service_discovery.go @@ -21,20 +21,24 @@ import ( "fmt" "strings" "sync" +) +import ( gxset "github.com/dubbogo/gost/container/set" - gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" + gxpage "github.com/dubbogo/gost/hash/page" + "github.com/dubbogo/gost/log/logger" + + "github.com/hashicorp/vault/sdk/helper/jsonutil" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" "dubbo.apache.org/dubbo-go/v3/remoting/etcdv3" - gxpage "github.com/dubbogo/gost/hash/page" - "github.com/dubbogo/gost/log/logger" - "github.com/hashicorp/vault/sdk/helper/jsonutil" ) const ( diff --git a/registry/event.go b/registry/event.go index e72128c517..13e066e908 100644 --- a/registry/event.go +++ b/registry/event.go @@ -21,10 +21,15 @@ import ( "fmt" "math/rand" "time" +) +import ( + "github.com/dubbogo/gost/gof/observer" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/gof/observer" ) type KeyFunc func(*common.URL) string diff --git a/registry/event/base_configuration_listener.go b/registry/event/base_configuration_listener.go index 7ffb85bcbd..73843116e9 100644 --- a/registry/event/base_configuration_listener.go +++ b/registry/event/base_configuration_listener.go @@ -17,14 +17,18 @@ package event +import ( + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" +) + import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/config" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) // nolint diff --git a/registry/event/metadata_service_url_params_customizer.go b/registry/event/metadata_service_url_params_customizer.go index 679de73142..48d8beddae 100644 --- a/registry/event/metadata_service_url_params_customizer.go +++ b/registry/event/metadata_service_url_params_customizer.go @@ -19,14 +19,19 @@ package event import ( "encoding/json" +) +import ( + gxset "github.com/dubbogo/gost/container/set" + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" "dubbo.apache.org/dubbo-go/v3/registry" - gxset "github.com/dubbogo/gost/container/set" - "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/registry/event/protocol_ports_metadata_customizer.go b/registry/event/protocol_ports_metadata_customizer.go index 8188d4c4da..8eeda26e0e 100644 --- a/registry/event/protocol_ports_metadata_customizer.go +++ b/registry/event/protocol_ports_metadata_customizer.go @@ -20,12 +20,17 @@ package event import ( "encoding/json" "strconv" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" "dubbo.apache.org/dubbo-go/v3/registry" - "github.com/dubbogo/gost/log/logger" ) func init() { diff --git a/registry/event/service_instances_changed_listener_impl.go b/registry/event/service_instances_changed_listener_impl.go index 82eb81cf25..a9ce70a52f 100644 --- a/registry/event/service_instances_changed_listener_impl.go +++ b/registry/event/service_instances_changed_listener_impl.go @@ -19,15 +19,20 @@ package event import ( "reflect" +) +import ( + gxset "github.com/dubbogo/gost/container/set" + "github.com/dubbogo/gost/gof/observer" + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" - gxset "github.com/dubbogo/gost/container/set" - "github.com/dubbogo/gost/gof/observer" - "github.com/dubbogo/gost/log/logger" ) // ServiceInstancesChangedListenerImpl The Service Discovery Changed Event Listener diff --git a/registry/event/service_revision_customizer.go b/registry/event/service_revision_customizer.go index 458b12a76c..62b5a91f79 100644 --- a/registry/event/service_revision_customizer.go +++ b/registry/event/service_revision_customizer.go @@ -21,13 +21,18 @@ import ( "fmt" "hash/crc32" "sort" +) +import ( + "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/metadata/service/local" "dubbo.apache.org/dubbo-go/v3/registry" - "github.com/dubbogo/gost/log/logger" ) const defaultRevision = "N/A" diff --git a/registry/mock_registry.go b/registry/mock_registry.go index 461ca8a2fa..8f4505c75a 100644 --- a/registry/mock_registry.go +++ b/registry/mock_registry.go @@ -20,12 +20,18 @@ package registry import ( "fmt" "time" +) - "dubbo.apache.org/dubbo-go/v3/common" +import ( "github.com/dubbogo/gost/log/logger" + "go.uber.org/atomic" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" +) + // MockRegistry is used as mock registry type MockRegistry struct { listener *listener diff --git a/registry/nacos/listener.go b/registry/nacos/listener.go index c200f8ff94..230630e7dd 100644 --- a/registry/nacos/listener.go +++ b/registry/nacos/listener.go @@ -23,20 +23,25 @@ import ( "reflect" "strconv" "sync" +) +import ( gxchan "github.com/dubbogo/gost/container/chan" - nacosClient "github.com/dubbogo/gost/database/kv/nacos" + "github.com/dubbogo/gost/log/logger" + "github.com/nacos-group/nacos-sdk-go/model" "github.com/nacos-group/nacos-sdk-go/vo" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) var ( diff --git a/registry/nacos/registry.go b/registry/nacos/registry.go index c50a140006..509ca8e7be 100644 --- a/registry/nacos/registry.go +++ b/registry/nacos/registry.go @@ -22,17 +22,23 @@ import ( "strconv" "strings" "time" +) +import ( nacosClient "github.com/dubbogo/gost/database/kv/nacos" + "github.com/dubbogo/gost/log/logger" + "github.com/nacos-group/nacos-sdk-go/vo" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting/nacos" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) var localIP = "" diff --git a/registry/nacos/service_discovery.go b/registry/nacos/service_discovery.go index dff674f726..313bb014d6 100644 --- a/registry/nacos/service_discovery.go +++ b/registry/nacos/service_discovery.go @@ -20,21 +20,26 @@ package nacos import ( "fmt" "sync" +) +import ( gxset "github.com/dubbogo/gost/container/set" nacosClient "github.com/dubbogo/gost/database/kv/nacos" - gxpage "github.com/dubbogo/gost/hash/page" + "github.com/dubbogo/gost/log/logger" + "github.com/nacos-group/nacos-sdk-go/model" "github.com/nacos-group/nacos-sdk-go/vo" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting/nacos" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) const ( diff --git a/registry/polaris/listener.go b/registry/polaris/listener.go index 1f2d13b087..a1ce95baa1 100644 --- a/registry/polaris/listener.go +++ b/registry/polaris/listener.go @@ -21,16 +21,22 @@ import ( "bytes" "net/url" "strconv" +) +import ( gxchan "github.com/dubbogo/gost/container/chan" + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" + + "github.com/polarismesh/polaris-go/pkg/model" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/registry" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - "github.com/polarismesh/polaris-go/pkg/model" ) type polarisListener struct { diff --git a/registry/polaris/registry.go b/registry/polaris/registry.go index afd67ff1a1..83759c9306 100644 --- a/registry/polaris/registry.go +++ b/registry/polaris/registry.go @@ -22,7 +22,18 @@ import ( "strconv" "sync" "time" +) + +import ( + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + + "github.com/polarismesh/polaris-go/api" + "github.com/polarismesh/polaris-go/pkg/model" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" @@ -30,10 +41,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" "dubbo.apache.org/dubbo-go/v3/remoting/polaris" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - "github.com/polarismesh/polaris-go/api" - "github.com/polarismesh/polaris-go/pkg/model" ) var localIP = "" diff --git a/registry/polaris/service_discovery.go b/registry/polaris/service_discovery.go index 9cba429d25..c4d6f189be 100644 --- a/registry/polaris/service_discovery.go +++ b/registry/polaris/service_discovery.go @@ -23,21 +23,26 @@ import ( "net/url" "sync" "time" +) +import ( gxset "github.com/dubbogo/gost/container/set" - gxpage "github.com/dubbogo/gost/hash/page" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" + + "github.com/polarismesh/polaris-go/api" + "github.com/polarismesh/polaris-go/pkg/model" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" "dubbo.apache.org/dubbo-go/v3/remoting/polaris" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - "github.com/polarismesh/polaris-go/api" - "github.com/polarismesh/polaris-go/pkg/model" ) // newPolarisServiceDiscovery will create new service discovery instance diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go index 5e9565df9e..282f4b7840 100644 --- a/registry/protocol/protocol.go +++ b/registry/protocol/protocol.go @@ -22,22 +22,25 @@ import ( "strings" "sync" "time" +) +import ( gxset "github.com/dubbogo/gost/container/set" + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/config_center" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - _ "dubbo.apache.org/dubbo-go/v3/config_center/configurator" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper" "dubbo.apache.org/dubbo-go/v3/registry" - _ "dubbo.apache.org/dubbo-go/v3/registry/directory" "dubbo.apache.org/dubbo-go/v3/remoting" ) diff --git a/registry/service_instance.go b/registry/service_instance.go index f0296c040c..6dc1061c19 100644 --- a/registry/service_instance.go +++ b/registry/service_instance.go @@ -20,13 +20,18 @@ package registry import ( "encoding/json" "strconv" +) - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" +import ( "github.com/dubbogo/gost/log/logger" gxsort "github.com/dubbogo/gost/sort" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" +) + // ServiceInstance is the interface which is used for service registration and discovery. type ServiceInstance interface { diff --git a/registry/service_instances_changed_listener.go b/registry/service_instances_changed_listener.go index 4c344c8238..940b126a3b 100644 --- a/registry/service_instances_changed_listener.go +++ b/registry/service_instances_changed_listener.go @@ -19,7 +19,9 @@ package registry import ( "reflect" +) +import ( gxset "github.com/dubbogo/gost/container/set" "github.com/dubbogo/gost/gof/observer" ) diff --git a/registry/servicediscovery/service_discovery_registry.go b/registry/servicediscovery/service_discovery_registry.go index 5ebccf3a53..6d1362b749 100644 --- a/registry/servicediscovery/service_discovery_registry.go +++ b/registry/servicediscovery/service_discovery_registry.go @@ -21,9 +21,18 @@ import ( "bytes" "strings" "sync" +) +import ( gxset "github.com/dubbogo/gost/container/set" + "github.com/dubbogo/gost/log/logger" + + perrors "github.com/pkg/errors" + + "go.uber.org/atomic" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" @@ -33,9 +42,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/registry/event" "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery/synthesizer" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - "go.uber.org/atomic" ) func init() { diff --git a/registry/xds/registry.go b/registry/xds/registry.go index 96f57193ed..f8d51cc5c1 100644 --- a/registry/xds/registry.go +++ b/registry/xds/registry.go @@ -22,15 +22,20 @@ import ( "os" "strconv" "strings" +) + +import ( + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting/xds" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - common2 "dubbo.apache.org/dubbo-go/v3/remoting/xds/common" ) diff --git a/registry/zookeeper/listener.go b/registry/zookeeper/listener.go index 10cf80ab9b..860b48deca 100644 --- a/registry/zookeeper/listener.go +++ b/registry/zookeeper/listener.go @@ -20,17 +20,22 @@ package zookeeper import ( "strings" "sync" +) +import ( gxchan "github.com/dubbogo/gost/container/chan" gxzookeeper "github.com/dubbogo/gost/database/kv/zk" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config_center" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) // RegistryDataListener contains all URL information subscribed by zookeeper registry diff --git a/registry/zookeeper/registry.go b/registry/zookeeper/registry.go index d7c2786dd7..c3cb6136c9 100644 --- a/registry/zookeeper/registry.go +++ b/registry/zookeeper/registry.go @@ -23,18 +23,23 @@ import ( "path" "sync" "time" +) +import ( "github.com/dubbogo/go-zookeeper/zk" gxzookeeper "github.com/dubbogo/gost/database/kv/zk" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting/zookeeper" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) func init() { diff --git a/registry/zookeeper/service_discovery.go b/registry/zookeeper/service_discovery.go index 9841c2208d..dfc3a0d73a 100644 --- a/registry/zookeeper/service_discovery.go +++ b/registry/zookeeper/service_discovery.go @@ -22,11 +22,16 @@ import ( "strconv" "strings" "sync" +) +import ( gxset "github.com/dubbogo/gost/container/set" - gxzookeeper "github.com/dubbogo/gost/database/kv/zk" + gxpage "github.com/dubbogo/gost/hash/page" + "github.com/dubbogo/gost/log/logger" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/common/extension" @@ -34,8 +39,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/remoting" "dubbo.apache.org/dubbo-go/v3/remoting/zookeeper" "dubbo.apache.org/dubbo-go/v3/remoting/zookeeper/curator_discovery" - gxpage "github.com/dubbogo/gost/hash/page" - "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/remoting/etcdv3/client.go b/remoting/etcdv3/client.go index eb164c84b7..863c11c535 100644 --- a/remoting/etcdv3/client.go +++ b/remoting/etcdv3/client.go @@ -19,8 +19,8 @@ package etcdv3 import ( gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" - "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) diff --git a/remoting/etcdv3/facade.go b/remoting/etcdv3/facade.go index 5c87d72ffa..ed59fd56d8 100644 --- a/remoting/etcdv3/facade.go +++ b/remoting/etcdv3/facade.go @@ -20,12 +20,17 @@ package etcdv3 import ( "sync" "time" +) - "dubbo.apache.org/dubbo-go/v3/common" +import ( gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" "github.com/dubbogo/gost/log/logger" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" +) + type clientFacade interface { Client() *gxetcd.Client SetClient(client *gxetcd.Client) diff --git a/remoting/etcdv3/listener.go b/remoting/etcdv3/listener.go index b0030137c7..86b5643a82 100644 --- a/remoting/etcdv3/listener.go +++ b/remoting/etcdv3/listener.go @@ -20,17 +20,23 @@ package etcdv3 import ( "sync" "time" +) +import ( gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" + "github.com/dubbogo/gost/log/logger" perrors "github.com/pkg/errors" + "go.etcd.io/etcd/api/v3/mvccpb" - "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" clientv3 "go.etcd.io/etcd/client/v3" ) +import ( + "dubbo.apache.org/dubbo-go/v3/remoting" +) + // nolint type EventListener struct { client *gxetcd.Client diff --git a/remoting/exchange.go b/remoting/exchange.go index 05654cdd5e..536dd58762 100644 --- a/remoting/exchange.go +++ b/remoting/exchange.go @@ -21,12 +21,18 @@ import ( "fmt" "sync" "time" +) - "dubbo.apache.org/dubbo-go/v3/common" +import ( "github.com/dubbogo/gost/log/logger" + "go.uber.org/atomic" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" +) + var ( sequence atomic.Int64 // generate request ID for global use pendingResponses = new(sync.Map) // store requestID and response diff --git a/remoting/exchange_client.go b/remoting/exchange_client.go index 839b078bec..ffc936592c 100644 --- a/remoting/exchange_client.go +++ b/remoting/exchange_client.go @@ -20,13 +20,19 @@ package remoting import ( "errors" "time" +) - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/protocol" +import ( "github.com/dubbogo/gost/log/logger" + uatomic "go.uber.org/atomic" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/protocol" +) + // Client is the interface that wraps SetExchangeClient、 Connect、Close、Request and // IsAvailable method. It is interface of client for network communication. If you // use getty as network communication, you should define GettyClient that implements diff --git a/remoting/getty/getty_client.go b/remoting/getty/getty_client.go index 8c3cb940ed..e523af1810 100644 --- a/remoting/getty/getty_client.go +++ b/remoting/getty/getty_client.go @@ -21,21 +21,27 @@ import ( "math/rand" "sync" "time" +) +import ( getty "github.com/apache/dubbo-getty" + "github.com/dubbogo/gost/log/logger" gxsync "github.com/dubbogo/gost/sync" - gxtime "github.com/dubbogo/gost/time" + perrors "github.com/pkg/errors" + + "go.uber.org/atomic" + + "gopkg.in/yaml.v2" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - "go.uber.org/atomic" - "gopkg.in/yaml.v2" ) var ( diff --git a/remoting/getty/getty_client_test.go b/remoting/getty/getty_client_test.go index d17f49091c..1135a2d5f1 100644 --- a/remoting/getty/getty_client_test.go +++ b/remoting/getty/getty_client_test.go @@ -24,13 +24,18 @@ import ( "sync" "testing" "time" +) +import ( hessian "github.com/apache/dubbo-go-hessian2" - "dubbo.apache.org/dubbo-go/v3/common" perrors "github.com/pkg/errors" + "github.com/stretchr/testify/assert" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common" . "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" diff --git a/remoting/getty/getty_server.go b/remoting/getty/getty_server.go index b08a4ff043..8dc0ee1bd6 100644 --- a/remoting/getty/getty_server.go +++ b/remoting/getty/getty_server.go @@ -21,20 +21,26 @@ import ( "crypto/tls" "fmt" "net" +) +import ( getty "github.com/apache/dubbo-getty" + "github.com/dubbogo/gost/log/logger" gxsync "github.com/dubbogo/gost/sync" + perrors "github.com/pkg/errors" + + "gopkg.in/yaml.v2" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config" "dubbo.apache.org/dubbo-go/v3/protocol" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" - "gopkg.in/yaml.v2" ) var ( diff --git a/remoting/getty/listener.go b/remoting/getty/listener.go index 600736ba59..9b27b1645c 100644 --- a/remoting/getty/listener.go +++ b/remoting/getty/listener.go @@ -21,18 +21,23 @@ import ( "sync" "sync/atomic" "time" +) +import ( getty "github.com/apache/dubbo-getty" hessian "github.com/apache/dubbo-go-hessian2" + "github.com/dubbogo/gost/log/logger" gxtime "github.com/dubbogo/gost/time" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol/invocation" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) const ( diff --git a/remoting/getty/pool.go b/remoting/getty/pool.go index 074ffb5cd3..2974809515 100644 --- a/remoting/getty/pool.go +++ b/remoting/getty/pool.go @@ -25,14 +25,20 @@ import ( "sync" "sync/atomic" "time" +) +import ( getty "github.com/apache/dubbo-getty" - "dubbo.apache.org/dubbo-go/v3/config" "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) +import ( + "dubbo.apache.org/dubbo-go/v3/config" +) + type gettyRPCClient struct { once sync.Once addr string // protocol string diff --git a/remoting/getty/readwriter.go b/remoting/getty/readwriter.go index 878e37597d..fad97645c3 100644 --- a/remoting/getty/readwriter.go +++ b/remoting/getty/readwriter.go @@ -19,15 +19,21 @@ package getty import ( "reflect" +) +import ( getty "github.com/apache/dubbo-getty" - "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl" - "dubbo.apache.org/dubbo-go/v3/remoting" "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) +import ( + "dubbo.apache.org/dubbo-go/v3/protocol/dubbo/impl" + "dubbo.apache.org/dubbo-go/v3/remoting" +) + // RpcClientPackageHandler Read data from server and Write data to server type RpcClientPackageHandler struct { client *Client diff --git a/remoting/getty/readwriter_test.go b/remoting/getty/readwriter_test.go index c8320d0d7b..52c748b0a6 100644 --- a/remoting/getty/readwriter_test.go +++ b/remoting/getty/readwriter_test.go @@ -22,7 +22,15 @@ import ( "reflect" "testing" "time" +) + +import ( + hessian "github.com/apache/dubbo-go-hessian2" + + "github.com/stretchr/testify/assert" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/protocol" @@ -30,8 +38,6 @@ import ( "dubbo.apache.org/dubbo-go/v3/protocol/invocation" "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" "dubbo.apache.org/dubbo-go/v3/remoting" - hessian "github.com/apache/dubbo-go-hessian2" - "github.com/stretchr/testify/assert" ) func TestTCPPackageHandle(t *testing.T) { diff --git a/remoting/nacos/builder.go b/remoting/nacos/builder.go index eba86cdeff..bc8ebccbd8 100644 --- a/remoting/nacos/builder.go +++ b/remoting/nacos/builder.go @@ -22,16 +22,21 @@ import ( "strconv" "strings" "time" +) +import ( nacosClient "github.com/dubbogo/gost/database/kv/nacos" + "github.com/dubbogo/gost/log/logger" nacosConstant "github.com/nacos-group/nacos-sdk-go/common/constant" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/config" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) // NewNacosConfigClientByUrl read the config from url and build an instance diff --git a/remoting/xds/client.go b/remoting/xds/client.go index 322350abfc..0592e5bb11 100644 --- a/remoting/xds/client.go +++ b/remoting/xds/client.go @@ -21,13 +21,18 @@ import ( "errors" "sync" "time" +) - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/protocol" - "dubbo.apache.org/dubbo-go/v3/registry" +import ( "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/protocol" + "dubbo.apache.org/dubbo-go/v3/registry" xdsCommon "dubbo.apache.org/dubbo-go/v3/remoting/xds/common" "dubbo.apache.org/dubbo-go/v3/remoting/xds/ewatcher" "dubbo.apache.org/dubbo-go/v3/remoting/xds/mapping" diff --git a/remoting/xds/ewatcher/ewatcher.go b/remoting/xds/ewatcher/ewatcher.go index 9795e61185..33f24f4dae 100644 --- a/remoting/xds/ewatcher/ewatcher.go +++ b/remoting/xds/ewatcher/ewatcher.go @@ -21,13 +21,17 @@ import ( "fmt" "strconv" "sync" +) + +import ( + "github.com/dubbogo/gost/log/logger" +) +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/registry" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" - xdsCommon "dubbo.apache.org/dubbo-go/v3/remoting/xds/common" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" ) diff --git a/remoting/xds/mapping/handler.go b/remoting/xds/mapping/handler.go index 64abf22528..b306b62b1f 100644 --- a/remoting/xds/mapping/handler.go +++ b/remoting/xds/mapping/handler.go @@ -24,13 +24,19 @@ import ( "net/http" "sync" "time" +) + +import ( + "github.com/dubbogo/gost/log/logger" structpb "github.com/golang/protobuf/ptypes/struct" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/remoting/xds/common" "dubbo.apache.org/dubbo-go/v3/xds/client" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) const ( diff --git a/remoting/zookeeper/client.go b/remoting/zookeeper/client.go index 568d3961a7..155f9193d7 100644 --- a/remoting/zookeeper/client.go +++ b/remoting/zookeeper/client.go @@ -19,14 +19,19 @@ package zookeeper import ( "strings" +) +import ( gxzookeeper "github.com/dubbogo/gost/database/kv/zk" - - "dubbo.apache.org/dubbo-go/v3/common/constant" "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common/constant" +) + const ( ConnDelay = 3 // connection delay interval MaxFailTimes = 3 // max fail times diff --git a/remoting/zookeeper/curator_discovery/service_discovery.go b/remoting/zookeeper/curator_discovery/service_discovery.go index 64c15b1051..0fdc9288a4 100644 --- a/remoting/zookeeper/curator_discovery/service_discovery.go +++ b/remoting/zookeeper/curator_discovery/service_discovery.go @@ -22,16 +22,21 @@ import ( "path" "strings" "sync" +) +import ( "github.com/dubbogo/go-zookeeper/zk" gxzookeeper "github.com/dubbogo/gost/database/kv/zk" + "github.com/dubbogo/gost/log/logger" + perrors "github.com/pkg/errors" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/remoting" "dubbo.apache.org/dubbo-go/v3/remoting/zookeeper" - "github.com/dubbogo/gost/log/logger" - perrors "github.com/pkg/errors" ) // Entry contain a service instance diff --git a/remoting/zookeeper/facade.go b/remoting/zookeeper/facade.go index 7e857cbc97..13d61cc72d 100644 --- a/remoting/zookeeper/facade.go +++ b/remoting/zookeeper/facade.go @@ -20,12 +20,17 @@ package zookeeper import ( "sync" "time" +) - "dubbo.apache.org/dubbo-go/v3/common" +import ( gxzookeeper "github.com/dubbogo/gost/database/kv/zk" "github.com/dubbogo/gost/log/logger" ) +import ( + "dubbo.apache.org/dubbo-go/v3/common" +) + type ZkClientFacade interface { ZkClient() *gxzookeeper.ZookeeperClient SetZkClient(*gxzookeeper.ZookeeperClient) diff --git a/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go index c277a11cef..26804732bc 100644 --- a/remoting/zookeeper/listener.go +++ b/remoting/zookeeper/listener.go @@ -22,18 +22,23 @@ import ( "strings" "sync" "time" +) +import ( "github.com/dubbogo/go-zookeeper/zk" gxzookeeper "github.com/dubbogo/gost/database/kv/zk" + "github.com/dubbogo/gost/log/logger" perrors "github.com/pkg/errors" + uatomic "go.uber.org/atomic" +) + +import ( "dubbo.apache.org/dubbo-go/v3/common" "dubbo.apache.org/dubbo-go/v3/common/constant" "dubbo.apache.org/dubbo-go/v3/remoting" - "github.com/dubbogo/gost/log/logger" - uatomic "go.uber.org/atomic" ) var defaultTTL = 10 * time.Minute diff --git a/xds/balancer/cdsbalancer/cdsbalancer.go b/xds/balancer/cdsbalancer/cdsbalancer.go index cd4dbab41b..07d63d44be 100644 --- a/xds/balancer/cdsbalancer/cdsbalancer.go +++ b/xds/balancer/cdsbalancer/cdsbalancer.go @@ -28,26 +28,33 @@ import ( "encoding/json" "errors" "fmt" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/tls/certprovider" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/balancer/clusterresolver" "dubbo.apache.org/dubbo-go/v3/xds/balancer/ringhash" "dubbo.apache.org/dubbo-go/v3/xds/client" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/buffer" - dubboLogger "github.com/dubbogo/gost/log/logger" - xdsinternal "dubbo.apache.org/dubbo-go/v3/xds/utils/credentials/xds" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" - internalserviceconfig "dubbo.apache.org/dubbo-go/v3/xds/utils/serviceconfig" ) diff --git a/xds/balancer/clusterimpl/clusterimpl.go b/xds/balancer/clusterimpl/clusterimpl.go index 6f576715bc..829144d577 100644 --- a/xds/balancer/clusterimpl/clusterimpl.go +++ b/xds/balancer/clusterimpl/clusterimpl.go @@ -33,14 +33,21 @@ import ( "fmt" "sync" "sync/atomic" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/resolver" - "google.golang.org/grpc/serviceconfig" - dubboLogger "github.com/dubbogo/gost/log/logger" + "google.golang.org/grpc/serviceconfig" +) +import ( internal "dubbo.apache.org/dubbo-go/v3/xds" "dubbo.apache.org/dubbo-go/v3/xds/balancer/loadstore" "dubbo.apache.org/dubbo-go/v3/xds/client" diff --git a/xds/balancer/clusterimpl/picker.go b/xds/balancer/clusterimpl/picker.go index fd710f923d..d92414e037 100644 --- a/xds/balancer/clusterimpl/picker.go +++ b/xds/balancer/clusterimpl/picker.go @@ -26,6 +26,8 @@ package clusterimpl import ( orcapb "github.com/cncf/xds/go/xds/data/orca/v3" + dubboLogger "github.com/dubbogo/gost/log/logger" + "google.golang.org/grpc/balancer" "google.golang.org/grpc/codes" @@ -33,11 +35,12 @@ import ( "google.golang.org/grpc/connectivity" "google.golang.org/grpc/status" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client" "dubbo.apache.org/dubbo-go/v3/xds/client/load" "dubbo.apache.org/dubbo-go/v3/xds/utils/wrr" - dubboLogger "github.com/dubbogo/gost/log/logger" ) // NewRandomWRR is used when calculating drops. It's exported so that tests can diff --git a/xds/balancer/clustermanager/balancerstateaggregator.go b/xds/balancer/clustermanager/balancerstateaggregator.go index 891a55a8db..81b0df07a4 100644 --- a/xds/balancer/clustermanager/balancerstateaggregator.go +++ b/xds/balancer/clustermanager/balancerstateaggregator.go @@ -26,12 +26,15 @@ package clustermanager import ( "fmt" "sync" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" - "google.golang.org/grpc/connectivity" - dubboLogger "github.com/dubbogo/gost/log/logger" + "google.golang.org/grpc/connectivity" ) type subBalancerState struct { diff --git a/xds/balancer/clustermanager/clustermanager.go b/xds/balancer/clustermanager/clustermanager.go index 5fd556b775..bda5edc4c1 100644 --- a/xds/balancer/clustermanager/clustermanager.go +++ b/xds/balancer/clustermanager/clustermanager.go @@ -27,15 +27,22 @@ package clustermanager import ( "encoding/json" "fmt" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/utils/balancergroup" "dubbo.apache.org/dubbo-go/v3/xds/utils/hierarchy" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" - dubboLogger "github.com/dubbogo/gost/log/logger" ) const balancerName = "xds_cluster_manager_experimental" diff --git a/xds/balancer/clusterresolver/clusterresolver.go b/xds/balancer/clusterresolver/clusterresolver.go index 846fe772ca..187f9b9040 100644 --- a/xds/balancer/clusterresolver/clusterresolver.go +++ b/xds/balancer/clusterresolver/clusterresolver.go @@ -28,21 +28,30 @@ import ( "encoding/json" "errors" "fmt" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/attributes" + "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/balancer/priority" "dubbo.apache.org/dubbo-go/v3/xds/client" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/buffer" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" - dubboLogger "github.com/dubbogo/gost/log/logger" ) // Name is the name of the cluster_resolver balancer. diff --git a/xds/balancer/clusterresolver/configbuilder.go b/xds/balancer/clusterresolver/configbuilder.go index cb5747cd33..999c6ff1ed 100644 --- a/xds/balancer/clusterresolver/configbuilder.go +++ b/xds/balancer/clusterresolver/configbuilder.go @@ -27,19 +27,24 @@ import ( "encoding/json" "fmt" "sort" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer/roundrobin" "google.golang.org/grpc/balancer/weightedroundrobin" "google.golang.org/grpc/balancer/weightedtarget" + "google.golang.org/grpc/resolver" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/balancer/clusterimpl" "dubbo.apache.org/dubbo-go/v3/xds/balancer/priority" "dubbo.apache.org/dubbo-go/v3/xds/balancer/ringhash" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/hierarchy" - dubboLogger "github.com/dubbogo/gost/log/logger" - internalserviceconfig "dubbo.apache.org/dubbo-go/v3/xds/utils/serviceconfig" ) diff --git a/xds/balancer/orca/orca.go b/xds/balancer/orca/orca.go index b4e7499f1f..a470ccb228 100644 --- a/xds/balancer/orca/orca.go +++ b/xds/balancer/orca/orca.go @@ -27,13 +27,17 @@ package orca import ( orcapb "github.com/cncf/xds/go/xds/data/orca/v3" + "github.com/dubbogo/gost/log/logger" + "github.com/golang/protobuf/proto" - "dubbo.apache.org/dubbo-go/v3/xds/utils/balancerload" - "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/metadata" ) +import ( + "dubbo.apache.org/dubbo-go/v3/xds/utils/balancerload" +) + const mdKey = "X-Endpoint-Load-Metrics-Bin" // toBytes converts a orca load report into bytes. diff --git a/xds/balancer/priority/balancer.go b/xds/balancer/priority/balancer.go index 48c6da96ae..daf6ac6ca0 100644 --- a/xds/balancer/priority/balancer.go +++ b/xds/balancer/priority/balancer.go @@ -33,17 +33,24 @@ import ( "fmt" "sync" "time" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/utils/balancergroup" "dubbo.apache.org/dubbo-go/v3/xds/utils/buffer" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" "dubbo.apache.org/dubbo-go/v3/xds/utils/hierarchy" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" - dubboLogger "github.com/dubbogo/gost/log/logger" ) // Name is the name of the priority balancer. diff --git a/xds/balancer/ringhash/picker.go b/xds/balancer/ringhash/picker.go index 7fdc806735..40ffcf841f 100644 --- a/xds/balancer/ringhash/picker.go +++ b/xds/balancer/ringhash/picker.go @@ -25,13 +25,18 @@ package ringhash import ( "fmt" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/status" - dubboLogger "github.com/dubbogo/gost/log/logger" + "google.golang.org/grpc/status" ) type picker struct { diff --git a/xds/balancer/ringhash/ringhash.go b/xds/balancer/ringhash/ringhash.go index a9a3b74ed5..3d2ad5cfd2 100644 --- a/xds/balancer/ringhash/ringhash.go +++ b/xds/balancer/ringhash/ringhash.go @@ -29,16 +29,24 @@ import ( "errors" "fmt" "sync" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" "google.golang.org/grpc/balancer/weightedroundrobin" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" - dubboLogger "github.com/dubbogo/gost/log/logger" ) // Name is the name of the ring_hash balancer. diff --git a/xds/client/authority.go b/xds/client/authority.go index ff16bf0ea3..b91abb538b 100644 --- a/xds/client/authority.go +++ b/xds/client/authority.go @@ -26,14 +26,19 @@ package client import ( "errors" "fmt" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" _struct "github.com/golang/protobuf/ptypes/struct" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client/bootstrap" "dubbo.apache.org/dubbo-go/v3/xds/client/load" "dubbo.apache.org/dubbo-go/v3/xds/client/pubsub" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" - dubboLogger "github.com/dubbogo/gost/log/logger" ) const federationScheme = "xdstp" diff --git a/xds/client/bootstrap/bootstrap.go b/xds/client/bootstrap/bootstrap.go index c58ca70c06..784aa84324 100644 --- a/xds/client/bootstrap/bootstrap.go +++ b/xds/client/bootstrap/bootstrap.go @@ -31,20 +31,25 @@ import ( "fmt" "io/ioutil" "strings" +) - v2corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" + v2corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" + "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" + "google.golang.org/grpc" "google.golang.org/grpc/credentials/google" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/tls/certprovider" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" - dubboLogger "github.com/dubbogo/gost/log/logger" - internal2 "dubbo.apache.org/dubbo-go/v3/xds/internal" "dubbo.apache.org/dubbo-go/v3/xds/utils/envconfig" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" diff --git a/xds/client/client.go b/xds/client/client.go index 4d5ec3e730..97e1904f00 100644 --- a/xds/client/client.go +++ b/xds/client/client.go @@ -29,14 +29,18 @@ import ( "fmt" "sync" "time" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" _struct "github.com/golang/protobuf/ptypes/struct" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client/bootstrap" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" - dubboLogger "github.com/dubbogo/gost/log/logger" - cache "dubbo.apache.org/dubbo-go/v3/xds/utils/xds_cache" ) diff --git a/xds/client/controller.go b/xds/client/controller.go index c6a6a544bb..f6ab527f99 100644 --- a/xds/client/controller.go +++ b/xds/client/controller.go @@ -24,14 +24,17 @@ package client import ( + dubboLogger "github.com/dubbogo/gost/log/logger" + _struct "github.com/golang/protobuf/ptypes/struct" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client/bootstrap" "dubbo.apache.org/dubbo-go/v3/xds/client/controller" "dubbo.apache.org/dubbo-go/v3/xds/client/load" "dubbo.apache.org/dubbo-go/v3/xds/client/pubsub" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" - dubboLogger "github.com/dubbogo/gost/log/logger" ) type controllerInterface interface { diff --git a/xds/client/controller/controller.go b/xds/client/controller/controller.go index 904066e307..4512cd447b 100644 --- a/xds/client/controller/controller.go +++ b/xds/client/controller/controller.go @@ -35,20 +35,26 @@ import ( "fmt" "sync" "time" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" _struct "github.com/golang/protobuf/ptypes/struct" + "google.golang.org/grpc" "google.golang.org/grpc/keepalive" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client/bootstrap" "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version" "dubbo.apache.org/dubbo-go/v3/xds/client/pubsub" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/backoff" "dubbo.apache.org/dubbo-go/v3/xds/utils/buffer" - dubboLogger "github.com/dubbogo/gost/log/logger" ) // Controller manages the connection and stream to the control plane. diff --git a/xds/client/controller/version/v2/client.go b/xds/client/controller/version/v2/client.go index 4f2b6efe0d..faf1fae791 100644 --- a/xds/client/controller/version/v2/client.go +++ b/xds/client/controller/version/v2/client.go @@ -27,25 +27,29 @@ package v2 import ( "context" "fmt" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" v2xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" v2corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" - v2adsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2" - "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/proto" _struct "github.com/golang/protobuf/ptypes/struct" statuspb "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" "google.golang.org/grpc/codes" - "google.golang.org/protobuf/types/known/anypb" - dubboLogger "github.com/dubbogo/gost/log/logger" + "google.golang.org/protobuf/types/known/anypb" +) +import ( controllerversion "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" - resourceversion "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" ) diff --git a/xds/client/controller/version/v3/client.go b/xds/client/controller/version/v3/client.go index 85acc58c6c..d231f33964 100644 --- a/xds/client/controller/version/v3/client.go +++ b/xds/client/controller/version/v3/client.go @@ -27,25 +27,29 @@ package v3 import ( "context" "fmt" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" v3adsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - v3discoverypb "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/proto" _struct "github.com/golang/protobuf/ptypes/struct" statuspb "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" "google.golang.org/grpc/codes" - "google.golang.org/protobuf/types/known/anypb" - dubboLogger "github.com/dubbogo/gost/log/logger" + "google.golang.org/protobuf/types/known/anypb" +) +import ( controllerversion "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" - resourceversion "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" ) diff --git a/xds/client/controller/version/version.go b/xds/client/controller/version/version.go index 0913cac5fe..5638c8bbcc 100644 --- a/xds/client/controller/version/version.go +++ b/xds/client/controller/version/version.go @@ -27,17 +27,23 @@ package version import ( "context" "time" +) - "github.com/golang/protobuf/proto" +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" + "github.com/golang/protobuf/proto" _struct "github.com/golang/protobuf/ptypes/struct" + "google.golang.org/grpc" + "google.golang.org/protobuf/types/known/anypb" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client/load" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" - dubboLogger "github.com/dubbogo/gost/log/logger" ) var ( diff --git a/xds/client/pubsub/pubsub.go b/xds/client/pubsub/pubsub.go index adba1e22ab..0ed8a54e7d 100644 --- a/xds/client/pubsub/pubsub.go +++ b/xds/client/pubsub/pubsub.go @@ -31,11 +31,16 @@ package pubsub import ( "sync" "time" +) +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/buffer" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" - dubboLogger "github.com/dubbogo/gost/log/logger" ) // Pubsub maintains resource watchers and resource updates. diff --git a/xds/client/resource/filter_chain.go b/xds/client/resource/filter_chain.go index dce698ea50..51801a534f 100644 --- a/xds/client/resource/filter_chain.go +++ b/xds/client/resource/filter_chain.go @@ -27,19 +27,24 @@ import ( "errors" "fmt" "net" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" v3httppb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" - v3tlspb "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" + "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" "dubbo.apache.org/dubbo-go/v3/xds/httpfilter" "dubbo.apache.org/dubbo-go/v3/xds/utils/envconfig" "dubbo.apache.org/dubbo-go/v3/xds/utils/resolver" - dubboLogger "github.com/dubbogo/gost/log/logger" ) const ( diff --git a/xds/client/resource/unmarshal.go b/xds/client/resource/unmarshal.go index 7b213d2050..22bfba526d 100644 --- a/xds/client/resource/unmarshal.go +++ b/xds/client/resource/unmarshal.go @@ -30,10 +30,12 @@ import ( "fmt" "strings" "time" +) - "google.golang.org/protobuf/types/known/anypb" - +import ( dubboLogger "github.com/dubbogo/gost/log/logger" + + "google.golang.org/protobuf/types/known/anypb" ) // UnmarshalOptions wraps the input parameters for `UnmarshalXxx` functions. diff --git a/xds/client/resource/unmarshal_cds.go b/xds/client/resource/unmarshal_cds.go index 3e2e22b1fc..1f765a5976 100644 --- a/xds/client/resource/unmarshal_cds.go +++ b/xds/client/resource/unmarshal_cds.go @@ -28,21 +28,26 @@ import ( "fmt" "net" "strconv" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" v3clusterpb "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - v3aggregateclusterpb "github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/aggregate/v3" - v3tlspb "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" + "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/types/known/anypb" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" "dubbo.apache.org/dubbo-go/v3/xds/utils/envconfig" "dubbo.apache.org/dubbo-go/v3/xds/utils/matcher" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" - dubboLogger "github.com/dubbogo/gost/log/logger" ) // TransportSocket proto message has a `name` field which is expected to be set diff --git a/xds/client/resource/unmarshal_eds.go b/xds/client/resource/unmarshal_eds.go index 6e3ad65aa8..b3aa4d9988 100644 --- a/xds/client/resource/unmarshal_eds.go +++ b/xds/client/resource/unmarshal_eds.go @@ -27,16 +27,22 @@ import ( "fmt" "net" "strconv" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" v3endpointpb "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" - v3typepb "github.com/envoyproxy/go-control-plane/envoy/type/v3" + "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/types/known/anypb" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" - dubboLogger "github.com/dubbogo/gost/log/logger" ) // UnmarshalEndpoints processes resources received in an EDS response, diff --git a/xds/client/resource/unmarshal_lds.go b/xds/client/resource/unmarshal_lds.go index 79c0e72061..01dcee2c63 100644 --- a/xds/client/resource/unmarshal_lds.go +++ b/xds/client/resource/unmarshal_lds.go @@ -27,24 +27,29 @@ import ( "errors" "fmt" "strconv" +) +import ( v1udpatypepb "github.com/cncf/udpa/go/udpa/type/v1" v3cncftypepb "github.com/cncf/xds/go/xds/type/v3" - v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" + dubboLogger "github.com/dubbogo/gost/log/logger" + v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" - v3httppb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" + "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" + "google.golang.org/protobuf/types/known/anypb" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" "dubbo.apache.org/dubbo-go/v3/xds/httpfilter" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" - dubboLogger "github.com/dubbogo/gost/log/logger" ) // UnmarshalListener processes resources received in an LDS response, validates diff --git a/xds/client/resource/unmarshal_rds.go b/xds/client/resource/unmarshal_rds.go index 5851ffd037..4b61a28462 100644 --- a/xds/client/resource/unmarshal_rds.go +++ b/xds/client/resource/unmarshal_rds.go @@ -28,18 +28,26 @@ import ( "regexp" "strings" "time" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" v3typepb "github.com/envoyproxy/go-control-plane/envoy/type/v3" + "github.com/golang/protobuf/proto" + "google.golang.org/grpc/codes" + "google.golang.org/protobuf/types/known/anypb" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client/resource/version" "dubbo.apache.org/dubbo-go/v3/xds/clusterspecifier" "dubbo.apache.org/dubbo-go/v3/xds/utils/envconfig" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" - dubboLogger "github.com/dubbogo/gost/log/logger" ) // UnmarshalRouteConfig processes resources received in an RDS response, diff --git a/xds/csds/csds.go b/xds/csds/csds.go index b3da260722..0f0424f2ab 100644 --- a/xds/csds/csds.go +++ b/xds/csds/csds.go @@ -31,31 +31,34 @@ package csds import ( "context" "io" +) + +import ( + "github.com/dubbogo/gost/log/logger" v3adminpb "github.com/envoyproxy/go-control-plane/envoy/admin/v3" v2corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" - v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - v3statusgrpc "github.com/envoyproxy/go-control-plane/envoy/service/status/v3" - - "dubbo.apache.org/dubbo-go/v3/xds/client" - "github.com/dubbogo/gost/log/logger" v3statuspb "github.com/envoyproxy/go-control-plane/envoy/service/status/v3" + "github.com/golang/protobuf/proto" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/timestamppb" +) +import ( + "dubbo.apache.org/dubbo-go/v3/xds/client" _ "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version/v2" - - // Register v2 xds_client. _ "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version/v3" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" ) // Register v3 xds_client. - var ( newXDSClient = func() client.XDSClient { c, err := client.New() diff --git a/xds/resolver/watch_service.go b/xds/resolver/watch_service.go index fdf82c0a3d..ba64863c6c 100644 --- a/xds/resolver/watch_service.go +++ b/xds/resolver/watch_service.go @@ -27,12 +27,17 @@ import ( "fmt" "sync" "time" +) +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" +) + +import ( "dubbo.apache.org/dubbo-go/v3/xds/client" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/clusterspecifier" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" - dubboLogger "github.com/dubbogo/gost/log/logger" ) // serviceUpdate contains information received from the LDS/RDS responses which diff --git a/xds/resolver/xds_resolver.go b/xds/resolver/xds_resolver.go index 79ae9a9ee3..3041aded24 100644 --- a/xds/resolver/xds_resolver.go +++ b/xds/resolver/xds_resolver.go @@ -29,17 +29,22 @@ import ( "errors" "fmt" "strings" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/resolver" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client" "dubbo.apache.org/dubbo-go/v3/xds/client/bootstrap" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" "dubbo.apache.org/dubbo-go/v3/xds/utils/pretty" - dubboLogger "github.com/dubbogo/gost/log/logger" - iresolver "dubbo.apache.org/dubbo-go/v3/xds/utils/resolver" ) diff --git a/xds/server/listener_wrapper.go b/xds/server/listener_wrapper.go index 4437db72a7..abc668390a 100644 --- a/xds/server/listener_wrapper.go +++ b/xds/server/listener_wrapper.go @@ -33,15 +33,21 @@ import ( "sync/atomic" "time" "unsafe" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/backoff" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/grpclog" +) +import ( "dubbo.apache.org/dubbo-go/v3/xds/client/bootstrap" "dubbo.apache.org/dubbo-go/v3/xds/client/resource" - dubboLogger "github.com/dubbogo/gost/log/logger" - internalbackoff "dubbo.apache.org/dubbo-go/v3/xds/utils/backoff" "dubbo.apache.org/dubbo-go/v3/xds/utils/envconfig" "dubbo.apache.org/dubbo-go/v3/xds/utils/grpcsync" diff --git a/xds/utils/balancergroup/balancergroup.go b/xds/utils/balancergroup/balancergroup.go index 39af4c649a..9e967460ff 100644 --- a/xds/utils/balancergroup/balancergroup.go +++ b/xds/utils/balancergroup/balancergroup.go @@ -29,13 +29,19 @@ import ( "fmt" "sync" "time" +) + +import ( + dubboLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/resolver" - dubboLogger "github.com/dubbogo/gost/log/logger" + "google.golang.org/grpc/resolver" +) +import ( cache "dubbo.apache.org/dubbo-go/v3/xds/utils/xds_cache" ) diff --git a/xds/utils/grpclog/grpclog.go b/xds/utils/grpclog/grpclog.go index 3d36045e98..1b7907edec 100644 --- a/xds/utils/grpclog/grpclog.go +++ b/xds/utils/grpclog/grpclog.go @@ -26,7 +26,9 @@ package grpclog import ( "os" +) +import ( "github.com/dubbogo/gost/log/logger" ) diff --git a/xds/utils/serviceconfig/serviceconfig.go b/xds/utils/serviceconfig/serviceconfig.go index bcce6c39dc..1384d51cd9 100644 --- a/xds/utils/serviceconfig/serviceconfig.go +++ b/xds/utils/serviceconfig/serviceconfig.go @@ -28,11 +28,15 @@ import ( "encoding/json" "fmt" "time" +) + +import ( + "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/codes" - "github.com/dubbogo/gost/log/logger" externalserviceconfig "google.golang.org/grpc/serviceconfig" ) From 9fc552e53d69444ac7f104005c7dadcd65e59429 Mon Sep 17 00:00:00 2001 From: Leospard <694963063@qq.com> Date: Mon, 4 Jul 2022 18:06:59 +0800 Subject: [PATCH 7/8] rename 'dubboLogger' to 'dubbogoLogger' --- xds/balancer/cdsbalancer/cdsbalancer.go | 6 +++--- xds/balancer/clusterimpl/clusterimpl.go | 6 +++--- xds/balancer/clusterimpl/picker.go | 4 ++-- .../clustermanager/balancerstateaggregator.go | 6 +++--- xds/balancer/clustermanager/clustermanager.go | 6 +++--- xds/balancer/clusterresolver/clusterresolver.go | 10 +++++----- xds/balancer/clusterresolver/configbuilder.go | 6 +++--- xds/balancer/priority/balancer.go | 6 +++--- xds/balancer/ringhash/picker.go | 6 +++--- xds/balancer/ringhash/ringhash.go | 8 ++++---- xds/client/authority.go | 4 ++-- xds/client/bootstrap/bootstrap.go | 14 +++++++------- xds/client/client.go | 6 +++--- xds/client/controller.go | 4 ++-- xds/client/controller/controller.go | 6 +++--- xds/client/controller/version/v2/client.go | 6 +++--- xds/client/controller/version/v3/client.go | 6 +++--- xds/client/controller/version/version.go | 4 ++-- xds/client/pubsub/pubsub.go | 6 +++--- xds/client/resource/filter_chain.go | 6 +++--- xds/client/resource/unmarshal.go | 4 ++-- xds/client/resource/unmarshal_cds.go | 6 +++--- xds/client/resource/unmarshal_eds.go | 6 +++--- xds/client/resource/unmarshal_lds.go | 12 ++++++------ xds/client/resource/unmarshal_rds.go | 12 ++++++------ xds/resolver/watch_service.go | 6 +++--- xds/resolver/xds_resolver.go | 6 +++--- xds/server/listener_wrapper.go | 6 +++--- xds/utils/balancergroup/balancergroup.go | 6 +++--- 29 files changed, 95 insertions(+), 95 deletions(-) diff --git a/xds/balancer/cdsbalancer/cdsbalancer.go b/xds/balancer/cdsbalancer/cdsbalancer.go index 07d63d44be..621c2a0b98 100644 --- a/xds/balancer/cdsbalancer/cdsbalancer.go +++ b/xds/balancer/cdsbalancer/cdsbalancer.go @@ -31,7 +31,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" @@ -98,7 +98,7 @@ func (bb) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Bal done: grpcsync.NewEvent(), xdsHI: xdsinternal.NewHandshakeInfo(nil, nil), } - b.logger = dubboLogger.GetLogger() + b.logger = dubbogoLogger.GetLogger() b.logger.Infof("Created") var creds credentials.TransportCredentials switch { @@ -173,7 +173,7 @@ type cdsBalancer struct { xdsClient client.XDSClient // xDS client to watch Cluster resource. clusterHandler *clusterHandler // To watch the clusters. childLB balancer.Balancer - logger dubboLogger.Logger + logger dubbogoLogger.Logger closed *grpcsync.Event done *grpcsync.Event diff --git a/xds/balancer/clusterimpl/clusterimpl.go b/xds/balancer/clusterimpl/clusterimpl.go index 829144d577..b998581b6f 100644 --- a/xds/balancer/clusterimpl/clusterimpl.go +++ b/xds/balancer/clusterimpl/clusterimpl.go @@ -36,7 +36,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" @@ -81,7 +81,7 @@ func (bb) Build(cc balancer.ClientConn, bOpts balancer.BuildOptions) balancer.Ba pickerUpdateCh: buffer.NewUnbounded(), requestCountMax: defaultRequestCountMax, } - b.logger = dubboLogger.GetLogger() + b.logger = dubbogoLogger.GetLogger() go b.run() b.logger.Infof("Created") return b @@ -111,7 +111,7 @@ type clusterImplBalancer struct { done *grpcsync.Event bOpts balancer.BuildOptions - logger dubboLogger.Logger + logger dubbogoLogger.Logger xdsClient client.XDSClient config *LBConfig diff --git a/xds/balancer/clusterimpl/picker.go b/xds/balancer/clusterimpl/picker.go index d92414e037..fa1e6d7937 100644 --- a/xds/balancer/clusterimpl/picker.go +++ b/xds/balancer/clusterimpl/picker.go @@ -26,7 +26,7 @@ package clusterimpl import ( orcapb "github.com/cncf/xds/go/xds/data/orca/v3" - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" @@ -151,7 +151,7 @@ func (d *picker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { // be used. lIDStr, e = scw.localityID().ToString() if e != nil { - dubboLogger.Infof("failed to marshal LocalityID: %#v, loads won't be reported", scw.localityID()) + dubbogoLogger.Infof("failed to marshal LocalityID: %#v, loads won't be reported", scw.localityID()) } } diff --git a/xds/balancer/clustermanager/balancerstateaggregator.go b/xds/balancer/clustermanager/balancerstateaggregator.go index 81b0df07a4..de5a957cca 100644 --- a/xds/balancer/clustermanager/balancerstateaggregator.go +++ b/xds/balancer/clustermanager/balancerstateaggregator.go @@ -29,7 +29,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" @@ -53,7 +53,7 @@ func (s *subBalancerState) String() string { type balancerStateAggregator struct { cc balancer.ClientConn - logger dubboLogger.Logger + logger dubbogoLogger.Logger mu sync.Mutex // If started is false, no updates should be sent to the parent cc. A closed @@ -68,7 +68,7 @@ type balancerStateAggregator struct { idToPickerState map[string]*subBalancerState } -func newBalancerStateAggregator(cc balancer.ClientConn, logger dubboLogger.Logger) *balancerStateAggregator { +func newBalancerStateAggregator(cc balancer.ClientConn, logger dubbogoLogger.Logger) *balancerStateAggregator { return &balancerStateAggregator{ cc: cc, logger: logger, diff --git a/xds/balancer/clustermanager/clustermanager.go b/xds/balancer/clustermanager/clustermanager.go index bda5edc4c1..21e154b5e3 100644 --- a/xds/balancer/clustermanager/clustermanager.go +++ b/xds/balancer/clustermanager/clustermanager.go @@ -30,7 +30,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" @@ -55,7 +55,7 @@ type bb struct{} func (bb) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer { b := &bal{} - b.logger = dubboLogger.GetLogger() + b.logger = dubbogoLogger.GetLogger() b.stateAggregator = newBalancerStateAggregator(cc, b.logger) b.stateAggregator.start() b.bg = balancergroup.New(cc, opts, b.stateAggregator, b.logger) @@ -73,7 +73,7 @@ func (bb) ParseConfig(c json.RawMessage) (serviceconfig.LoadBalancingConfig, err } type bal struct { - logger dubboLogger.Logger + logger dubbogoLogger.Logger // TODO: make this package not dependent on xds specific code. Same as for // weighted target balancer. diff --git a/xds/balancer/clusterresolver/clusterresolver.go b/xds/balancer/clusterresolver/clusterresolver.go index 187f9b9040..3c7fb2836f 100644 --- a/xds/balancer/clusterresolver/clusterresolver.go +++ b/xds/balancer/clusterresolver/clusterresolver.go @@ -31,7 +31,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/attributes" @@ -74,12 +74,12 @@ type bb struct{} func (bb) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer { priorityBuilder := balancer.Get(priority.Name) if priorityBuilder == nil { - dubboLogger.Errorf("priority balancer is needed but not registered") + dubbogoLogger.Errorf("priority balancer is needed but not registered") return nil } priorityConfigParser, ok := priorityBuilder.(balancer.ConfigParser) if !ok { - dubboLogger.Errorf("priority balancer builder is not a config parser") + dubbogoLogger.Errorf("priority balancer builder is not a config parser") return nil } @@ -92,7 +92,7 @@ func (bb) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Bal priorityBuilder: priorityBuilder, priorityConfigParser: priorityConfigParser, } - b.logger = dubboLogger.GetLogger() + b.logger = dubbogoLogger.GetLogger() b.logger.Infof("Created") b.resourceWatcher = newResourceResolver(b) @@ -142,7 +142,7 @@ type clusterResolverBalancer struct { bOpts balancer.BuildOptions updateCh *buffer.Unbounded // Channel for updates from gRPC. resourceWatcher *resourceResolver - logger dubboLogger.Logger + logger dubbogoLogger.Logger closed *grpcsync.Event done *grpcsync.Event diff --git a/xds/balancer/clusterresolver/configbuilder.go b/xds/balancer/clusterresolver/configbuilder.go index 999c6ff1ed..78be8a278d 100644 --- a/xds/balancer/clusterresolver/configbuilder.go +++ b/xds/balancer/clusterresolver/configbuilder.go @@ -30,7 +30,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer/roundrobin" "google.golang.org/grpc/balancer/weightedroundrobin" @@ -278,7 +278,7 @@ func priorityLocalitiesToClusterImpl(localities []resource.Locality, priorityNam // If lb policy is ROUND_ROBIN: // - locality-picking policy is weighted_target // - endpoint-picking policy is round_robin - dubboLogger.Infof("xds lb policy is %q, building config with weighted_target + round_robin", rrName) + dubbogoLogger.Infof("xds lb policy is %q, building config with weighted_target + round_robin", rrName) // Child of weighted_target is hardcoded to round_robin. wtConfig, addrs := localitiesToWeightedTarget(localities, priorityName, rrBalancerConfig) clusterImplCfg.ChildPolicy = &internalserviceconfig.BalancerConfig{Name: weightedtarget.Name, Config: wtConfig} @@ -289,7 +289,7 @@ func priorityLocalitiesToClusterImpl(localities []resource.Locality, priorityNam // If lb policy is RIHG_HASH, will build one ring_hash policy as child. // The endpoints from all localities will be flattened to one addresses // list, and the ring_hash policy will pick endpoints from it. - dubboLogger.Infof("xds lb policy is %q, building config with ring_hash", rhName) + dubbogoLogger.Infof("xds lb policy is %q, building config with ring_hash", rhName) addrs := localitiesToRingHash(localities, priorityName) // Set child to ring_hash, note that the ring_hash config is from // xdsLBPolicy. diff --git a/xds/balancer/priority/balancer.go b/xds/balancer/priority/balancer.go index daf6ac6ca0..5c4c8bb0f5 100644 --- a/xds/balancer/priority/balancer.go +++ b/xds/balancer/priority/balancer.go @@ -36,7 +36,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" @@ -71,7 +71,7 @@ func (bb) Build(cc balancer.ClientConn, bOpts balancer.BuildOptions) balancer.Ba childBalancerStateUpdate: buffer.NewUnbounded(), } - b.logger = dubboLogger.GetLogger() + b.logger = dubbogoLogger.GetLogger() b.bg = balancergroup.New(cc, bOpts, b, b.logger) b.bg.Start() go b.run() @@ -95,7 +95,7 @@ type timerWrapper struct { } type priorityBalancer struct { - logger dubboLogger.Logger + logger dubbogoLogger.Logger cc balancer.ClientConn bg *balancergroup.BalancerGroup done *grpcsync.Event diff --git a/xds/balancer/ringhash/picker.go b/xds/balancer/ringhash/picker.go index 40ffcf841f..7611436bed 100644 --- a/xds/balancer/ringhash/picker.go +++ b/xds/balancer/ringhash/picker.go @@ -28,7 +28,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" @@ -41,10 +41,10 @@ import ( type picker struct { ring *ring - logger dubboLogger.Logger + logger dubbogoLogger.Logger } -func newPicker(ring *ring, logger dubboLogger.Logger) *picker { +func newPicker(ring *ring, logger dubbogoLogger.Logger) *picker { return &picker{ring: ring, logger: logger} } diff --git a/xds/balancer/ringhash/ringhash.go b/xds/balancer/ringhash/ringhash.go index 3d2ad5cfd2..4f3a3e5350 100644 --- a/xds/balancer/ringhash/ringhash.go +++ b/xds/balancer/ringhash/ringhash.go @@ -32,7 +32,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" @@ -65,7 +65,7 @@ func (bb) Build(cc balancer.ClientConn, bOpts balancer.BuildOptions) balancer.Ba scStates: make(map[balancer.SubConn]*subConn), csEvltr: &connectivityStateEvaluator{}, } - b.logger = dubboLogger.GetLogger() + b.logger = dubbogoLogger.GetLogger() b.logger.Infof("Created") return b } @@ -174,7 +174,7 @@ func (sc *subConn) queueConnect() { type ringhashBalancer struct { cc balancer.ClientConn - logger dubboLogger.Logger + logger dubbogoLogger.Logger config *LBConfig @@ -232,7 +232,7 @@ func (b *ringhashBalancer) updateAddresses(addrs []resolver.Address) bool { // (like creds) will be used. sc, err := b.cc.NewSubConn([]resolver.Address{a}, balancer.NewSubConnOptions{HealthCheckEnabled: true}) if err != nil { - dubboLogger.Warnf("base.baseBalancer: failed to create new SubConn: %v", err) + dubbogoLogger.Warnf("base.baseBalancer: failed to create new SubConn: %v", err) continue } scs := &subConn{addr: a.Addr, sc: sc} diff --git a/xds/client/authority.go b/xds/client/authority.go index b91abb538b..a18737c11d 100644 --- a/xds/client/authority.go +++ b/xds/client/authority.go @@ -29,7 +29,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" _struct "github.com/golang/protobuf/ptypes/struct" ) @@ -73,7 +73,7 @@ func (c *clientImpl) findAuthority(n *resource.Name) (_ *authority, unref func() a, err := c.newAuthority(config) if err != nil { - dubboLogger.Errorf(`[XDS Authority] new authority failed with error = %s, please makesure you have imported + dubbogoLogger.Errorf(`[XDS Authority] new authority failed with error = %s, please makesure you have imported _ "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version/v2" _ "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version/v3"`, err) return nil, nil, fmt.Errorf("xds: failed to connect to the control plane for authority %q: %v", authority, err) diff --git a/xds/client/bootstrap/bootstrap.go b/xds/client/bootstrap/bootstrap.go index 784aa84324..ffa02fe66d 100644 --- a/xds/client/bootstrap/bootstrap.go +++ b/xds/client/bootstrap/bootstrap.go @@ -34,7 +34,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" v2corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" @@ -276,7 +276,7 @@ func bootstrapConfigFromEnvVariable() ([]byte, error) { // // Note that even if the content is invalid, we don't failover to the // file content env variable. - dubboLogger.Debugf("xds: using bootstrap file with name %q", fName) + dubbogoLogger.Debugf("xds: using bootstrap file with name %q", fName) return bootstrapFileReadFunc(fName) } @@ -306,7 +306,7 @@ func NewConfig() (*Config, error) { if err != nil { return nil, fmt.Errorf("xds: Failed to read bootstrap config: %v", err) } - dubboLogger.Debugf("Bootstrap content: %s", data) + dubbogoLogger.Debugf("Bootstrap content: %s", data) return NewConfigFromContents(data) } @@ -375,7 +375,7 @@ func NewConfigFromContents(data []byte) (*Config, error) { } case "client_default_listener_resource_name_template": if !envconfig.XDSFederation { - dubboLogger.Warnf("xds: bootstrap field %v is not support when Federation is disabled", k) + dubbogoLogger.Warnf("xds: bootstrap field %v is not support when Federation is disabled", k) continue } if err := json.Unmarshal(v, &config.ClientDefaultListenerResourceNameTemplate); err != nil { @@ -383,14 +383,14 @@ func NewConfigFromContents(data []byte) (*Config, error) { } case "authorities": if !envconfig.XDSFederation { - dubboLogger.Warnf("xds: bootstrap field %v is not support when Federation is disabled", k) + dubbogoLogger.Warnf("xds: bootstrap field %v is not support when Federation is disabled", k) continue } if err := json.Unmarshal(v, &config.Authorities); err != nil { return nil, fmt.Errorf("xds: json.Unmarshal(%v) for field %q failed during bootstrap: %v", string(v), k, err) } default: - dubboLogger.Warnf("Bootstrap content has unknown field: %s", k) + dubbogoLogger.Warnf("Bootstrap content has unknown field: %s", k) } // Do not fail the xDS bootstrap when an unknown field is seen. This can // happen when an older version client reads a newer version bootstrap @@ -427,7 +427,7 @@ func NewConfigFromContents(data []byte) (*Config, error) { if err := config.updateNodeProto(node); err != nil { return nil, err } - dubboLogger.Infof("Bootstrap config for creating xds-client: %v", pretty.ToJSON(config)) + dubbogoLogger.Infof("Bootstrap config for creating xds-client: %v", pretty.ToJSON(config)) return config, nil } diff --git a/xds/client/client.go b/xds/client/client.go index 97e1904f00..2821ba8f5f 100644 --- a/xds/client/client.go +++ b/xds/client/client.go @@ -32,7 +32,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" _struct "github.com/golang/protobuf/ptypes/struct" ) @@ -76,7 +76,7 @@ type clientImpl struct { // never both. idleAuthorities *cache.TimeoutCache - logger dubboLogger.Logger + logger dubbogoLogger.Logger watchExpiryTimeout time.Duration } @@ -97,7 +97,7 @@ func newWithConfig(config *bootstrap.Config, watchExpiryTimeout time.Duration, i } }() - c.logger = dubboLogger.GetLogger() + c.logger = dubbogoLogger.GetLogger() c.logger.Infof("Created ClientConn to xDS management server: %s", config.XDSServer) c.logger.Infof("Created") diff --git a/xds/client/controller.go b/xds/client/controller.go index f6ab527f99..79019c3529 100644 --- a/xds/client/controller.go +++ b/xds/client/controller.go @@ -24,7 +24,7 @@ package client import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" _struct "github.com/golang/protobuf/ptypes/struct" ) @@ -45,6 +45,6 @@ type controllerInterface interface { Close() } -var newController = func(config *bootstrap.ServerConfig, pubsub *pubsub.Pubsub, validator resource.UpdateValidatorFunc, logger dubboLogger.Logger) (controllerInterface, error) { +var newController = func(config *bootstrap.ServerConfig, pubsub *pubsub.Pubsub, validator resource.UpdateValidatorFunc, logger dubbogoLogger.Logger) (controllerInterface, error) { return controller.New(config, pubsub, validator, logger) } diff --git a/xds/client/controller/controller.go b/xds/client/controller/controller.go index 4512cd447b..f112f1fa5a 100644 --- a/xds/client/controller/controller.go +++ b/xds/client/controller/controller.go @@ -38,7 +38,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" @@ -68,7 +68,7 @@ type Controller struct { config *bootstrap.ServerConfig updateHandler pubsub.UpdateHandler updateValidator resource.UpdateValidatorFunc - logger dubboLogger.Logger + logger dubbogoLogger.Logger cc *grpc.ClientConn // Connection to the management server. vClient version.MetadataWrappedVersionClient @@ -105,7 +105,7 @@ type Controller struct { } // New creates a new controller. -func New(config *bootstrap.ServerConfig, updateHandler pubsub.UpdateHandler, validator resource.UpdateValidatorFunc, logger dubboLogger.Logger) (_ *Controller, retErr error) { +func New(config *bootstrap.ServerConfig, updateHandler pubsub.UpdateHandler, validator resource.UpdateValidatorFunc, logger dubbogoLogger.Logger) (_ *Controller, retErr error) { switch { case config == nil: return nil, errors.New("xds: no xds_server provided") diff --git a/xds/client/controller/version/v2/client.go b/xds/client/controller/version/v2/client.go index faf1fae791..4eac9ba44b 100644 --- a/xds/client/controller/version/v2/client.go +++ b/xds/client/controller/version/v2/client.go @@ -30,7 +30,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" v2xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" v2corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" @@ -72,7 +72,7 @@ func newClient(opts controllerversion.BuildOptions) (controllerversion.MetadataW if !ok { return nil, fmt.Errorf("xds: unsupported Node proto type: %T, want %T", opts.NodeProto, (*v2corepb.Node)(nil)) } - v2c := &client{nodeProto: nodeProto, logger: dubboLogger.GetLogger()} + v2c := &client{nodeProto: nodeProto, logger: dubbogoLogger.GetLogger()} return v2c, nil } @@ -83,7 +83,7 @@ type adsStream v2adsgrpc.AggregatedDiscoveryService_StreamAggregatedResourcesCli // are multiplexed. type client struct { nodeProto *v2corepb.Node - logger dubboLogger.Logger + logger dubbogoLogger.Logger } // SetMetadata update client metadata diff --git a/xds/client/controller/version/v3/client.go b/xds/client/controller/version/v3/client.go index d231f33964..ada3e1de3e 100644 --- a/xds/client/controller/version/v3/client.go +++ b/xds/client/controller/version/v3/client.go @@ -30,7 +30,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" v3adsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" @@ -73,7 +73,7 @@ func newClient(opts controllerversion.BuildOptions) (controllerversion.MetadataW return nil, fmt.Errorf("xds: unsupported Node proto type: %T, want %T", opts.NodeProto, v3corepb.Node{}) } v3c := &client{ - nodeProto: nodeProto, logger: dubboLogger.GetLogger(), + nodeProto: nodeProto, logger: dubbogoLogger.GetLogger(), } return v3c, nil } @@ -85,7 +85,7 @@ type adsStream v3adsgrpc.AggregatedDiscoveryService_StreamAggregatedResourcesCli // are multiplexed. type client struct { nodeProto *v3corepb.Node - logger dubboLogger.Logger + logger dubbogoLogger.Logger } func (v3c *client) NewStream(ctx context.Context, cc *grpc.ClientConn) (grpc.ClientStream, error) { diff --git a/xds/client/controller/version/version.go b/xds/client/controller/version/version.go index 5638c8bbcc..3487b8f424 100644 --- a/xds/client/controller/version/version.go +++ b/xds/client/controller/version/version.go @@ -30,7 +30,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "github.com/golang/protobuf/proto" _struct "github.com/golang/protobuf/ptypes/struct" @@ -78,7 +78,7 @@ type BuildOptions struct { // // streams. // Backoff func(int) time.Duration // Logger provides enhanced logging capabilities. - Logger dubboLogger.Logger + Logger dubbogoLogger.Logger } // LoadReportingOptions contains configuration knobs for reporting load data. diff --git a/xds/client/pubsub/pubsub.go b/xds/client/pubsub/pubsub.go index 0ed8a54e7d..ea25682729 100644 --- a/xds/client/pubsub/pubsub.go +++ b/xds/client/pubsub/pubsub.go @@ -34,7 +34,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" ) import ( @@ -50,7 +50,7 @@ import ( // any time. type Pubsub struct { done *grpcsync.Event - logger dubboLogger.Logger + logger dubbogoLogger.Logger watchExpiryTimeout time.Duration updateCh *buffer.Unbounded // chan *watcherInfoWithUpdate @@ -71,7 +71,7 @@ type Pubsub struct { } // New creates a new Pubsub. -func New(watchExpiryTimeout time.Duration, logger dubboLogger.Logger) *Pubsub { +func New(watchExpiryTimeout time.Duration, logger dubbogoLogger.Logger) *Pubsub { pb := &Pubsub{ done: grpcsync.NewEvent(), logger: logger, diff --git a/xds/client/resource/filter_chain.go b/xds/client/resource/filter_chain.go index 51801a534f..e59e2386cc 100644 --- a/xds/client/resource/filter_chain.go +++ b/xds/client/resource/filter_chain.go @@ -30,7 +30,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" v3httppb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" @@ -190,7 +190,7 @@ const ( // 7. Source IP address. // 8. Source port. type FilterChainManager struct { - logger dubboLogger.Logger + logger dubbogoLogger.Logger // Destination prefix is the first match criteria that we support. // Therefore, this multi-stage map is indexed on destination prefixes // specified in the match criteria. @@ -261,7 +261,7 @@ type sourcePrefixEntry struct { // // This function is only exported so that tests outside of this package can // create a FilterChainManager. -func NewFilterChainManager(lis *v3listenerpb.Listener, logger dubboLogger.Logger) (*FilterChainManager, error) { +func NewFilterChainManager(lis *v3listenerpb.Listener, logger dubbogoLogger.Logger) (*FilterChainManager, error) { // Parse all the filter chains and build the internal data structures. fci := &FilterChainManager{ logger: logger, diff --git a/xds/client/resource/unmarshal.go b/xds/client/resource/unmarshal.go index 22bfba526d..64da2c1f08 100644 --- a/xds/client/resource/unmarshal.go +++ b/xds/client/resource/unmarshal.go @@ -33,7 +33,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/protobuf/types/known/anypb" ) @@ -45,7 +45,7 @@ type UnmarshalOptions struct { // Resources are the xDS resources resources in the received response. Resources []*anypb.Any // Logger is the prefix logger to be used during unmarshaling. - Logger dubboLogger.Logger + Logger dubbogoLogger.Logger // UpdateValidator is a post unmarshal validation check provided by the // upper layer. UpdateValidator UpdateValidatorFunc diff --git a/xds/client/resource/unmarshal_cds.go b/xds/client/resource/unmarshal_cds.go index 1f765a5976..8e8d7d6f25 100644 --- a/xds/client/resource/unmarshal_cds.go +++ b/xds/client/resource/unmarshal_cds.go @@ -31,7 +31,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" v3clusterpb "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" @@ -63,7 +63,7 @@ func UnmarshalCluster(opts *UnmarshalOptions) (map[string]ClusterUpdateErrTuple, return update, md, err } -func unmarshalClusterResource(r *anypb.Any, f UpdateValidatorFunc, logger dubboLogger.Logger) (string, ClusterUpdate, error) { +func unmarshalClusterResource(r *anypb.Any, f UpdateValidatorFunc, logger dubbogoLogger.Logger) (string, ClusterUpdate, error) { if !IsClusterResource(r.GetTypeUrl()) { return "", ClusterUpdate{}, fmt.Errorf("unexpected resource type: %q ", r.GetTypeUrl()) } @@ -72,7 +72,7 @@ func unmarshalClusterResource(r *anypb.Any, f UpdateValidatorFunc, logger dubboL if err := proto.Unmarshal(r.GetValue(), cluster); err != nil { return "", ClusterUpdate{}, fmt.Errorf("failed to unmarshal resource: %v", err) } - dubboLogger.Debugf("Resource with name: %v, type: %T, contains: %v", cluster.GetName(), cluster, pretty.ToJSON(cluster)) + dubbogoLogger.Debugf("Resource with name: %v, type: %T, contains: %v", cluster.GetName(), cluster, pretty.ToJSON(cluster)) cu, err := validateClusterAndConstructClusterUpdate(cluster) if err != nil { return cluster.GetName(), ClusterUpdate{}, err diff --git a/xds/client/resource/unmarshal_eds.go b/xds/client/resource/unmarshal_eds.go index b3aa4d9988..07111a9606 100644 --- a/xds/client/resource/unmarshal_eds.go +++ b/xds/client/resource/unmarshal_eds.go @@ -30,7 +30,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" v3endpointpb "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" @@ -54,7 +54,7 @@ func UnmarshalEndpoints(opts *UnmarshalOptions) (map[string]EndpointsUpdateErrTu return update, md, err } -func unmarshalEndpointsResource(r *anypb.Any, logger dubboLogger.Logger) (string, EndpointsUpdate, error) { +func unmarshalEndpointsResource(r *anypb.Any, logger dubbogoLogger.Logger) (string, EndpointsUpdate, error) { if !IsEndpointsResource(r.GetTypeUrl()) { return "", EndpointsUpdate{}, fmt.Errorf("unexpected resource type: %q ", r.GetTypeUrl()) } @@ -63,7 +63,7 @@ func unmarshalEndpointsResource(r *anypb.Any, logger dubboLogger.Logger) (string if err := proto.Unmarshal(r.GetValue(), cla); err != nil { return "", EndpointsUpdate{}, fmt.Errorf("failed to unmarshal resource: %v", err) } - dubboLogger.Debugf("Resource with name: %v, type: %T, contains: %v", cla.GetClusterName(), cla, pretty.ToJSON(cla)) + dubbogoLogger.Debugf("Resource with name: %v, type: %T, contains: %v", cla.GetClusterName(), cla, pretty.ToJSON(cla)) u, err := parseEDSRespProto(cla) if err != nil { diff --git a/xds/client/resource/unmarshal_lds.go b/xds/client/resource/unmarshal_lds.go index 01dcee2c63..b2efbac815 100644 --- a/xds/client/resource/unmarshal_lds.go +++ b/xds/client/resource/unmarshal_lds.go @@ -34,7 +34,7 @@ import ( v3cncftypepb "github.com/cncf/xds/go/xds/type/v3" - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" @@ -61,7 +61,7 @@ func UnmarshalListener(opts *UnmarshalOptions) (map[string]ListenerUpdateErrTupl return update, md, err } -func unmarshalListenerResource(r *anypb.Any, f UpdateValidatorFunc, logger dubboLogger.Logger) (string, ListenerUpdate, error) { +func unmarshalListenerResource(r *anypb.Any, f UpdateValidatorFunc, logger dubbogoLogger.Logger) (string, ListenerUpdate, error) { if !IsListenerResource(r.GetTypeUrl()) { return "", ListenerUpdate{}, fmt.Errorf("unexpected resource type: %q ", r.GetTypeUrl()) } @@ -71,7 +71,7 @@ func unmarshalListenerResource(r *anypb.Any, f UpdateValidatorFunc, logger dubbo if err := proto.Unmarshal(r.GetValue(), lis); err != nil { return "", ListenerUpdate{}, fmt.Errorf("failed to unmarshal resource: %v", err) } - dubboLogger.Debugf("Resource with name: %v, type: %T, contains: %v", lis.GetName(), lis, pretty.ToJSON(lis)) + dubbogoLogger.Debugf("Resource with name: %v, type: %T, contains: %v", lis.GetName(), lis, pretty.ToJSON(lis)) lu, err := processListener(lis, logger, v2) if err != nil { @@ -86,7 +86,7 @@ func unmarshalListenerResource(r *anypb.Any, f UpdateValidatorFunc, logger dubbo return lis.GetName(), *lu, nil } -func processListener(lis *v3listenerpb.Listener, logger dubboLogger.Logger, v2 bool) (*ListenerUpdate, error) { +func processListener(lis *v3listenerpb.Listener, logger dubbogoLogger.Logger, v2 bool) (*ListenerUpdate, error) { if lis.GetApiListener() != nil { return processClientSideListener(lis, logger, v2) } @@ -95,7 +95,7 @@ func processListener(lis *v3listenerpb.Listener, logger dubboLogger.Logger, v2 b // processClientSideListener checks if the provided Listener proto meets // the expected criteria. If so, it returns a non-empty routeConfigName. -func processClientSideListener(lis *v3listenerpb.Listener, logger dubboLogger.Logger, v2 bool) (*ListenerUpdate, error) { +func processClientSideListener(lis *v3listenerpb.Listener, logger dubbogoLogger.Logger, v2 bool) (*ListenerUpdate, error) { update := &ListenerUpdate{} apiLisAny := lis.GetApiListener().GetApiListener() @@ -282,7 +282,7 @@ func processHTTPFilters(filters []*v3httppb.HttpFilter, server bool) ([]HTTPFilt return ret, nil } -func processServerSideListener(lis *v3listenerpb.Listener, logger dubboLogger.Logger) (*ListenerUpdate, error) { +func processServerSideListener(lis *v3listenerpb.Listener, logger dubbogoLogger.Logger) (*ListenerUpdate, error) { if n := len(lis.ListenerFilters); n != 0 { return nil, fmt.Errorf("unsupported field 'listener_filters' contains %d entries", n) } diff --git a/xds/client/resource/unmarshal_rds.go b/xds/client/resource/unmarshal_rds.go index 4b61a28462..9b8717ae4c 100644 --- a/xds/client/resource/unmarshal_rds.go +++ b/xds/client/resource/unmarshal_rds.go @@ -31,7 +31,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" v3typepb "github.com/envoyproxy/go-control-plane/envoy/type/v3" @@ -60,7 +60,7 @@ func UnmarshalRouteConfig(opts *UnmarshalOptions) (map[string]RouteConfigUpdateE return update, md, err } -func unmarshalRouteConfigResource(r *anypb.Any, logger dubboLogger.Logger) (string, RouteConfigUpdate, error) { +func unmarshalRouteConfigResource(r *anypb.Any, logger dubbogoLogger.Logger) (string, RouteConfigUpdate, error) { if !IsRouteConfigResource(r.GetTypeUrl()) { return "", RouteConfigUpdate{}, fmt.Errorf("unexpected resource type: %q ", r.GetTypeUrl()) } @@ -68,7 +68,7 @@ func unmarshalRouteConfigResource(r *anypb.Any, logger dubboLogger.Logger) (stri if err := proto.Unmarshal(r.GetValue(), rc); err != nil { return "", RouteConfigUpdate{}, fmt.Errorf("failed to unmarshal resource: %v", err) } - dubboLogger.Debugf("Resource with name: %v, type: %T, contains: %v.", rc.GetName(), rc, pretty.ToJSON(rc)) + dubbogoLogger.Debugf("Resource with name: %v, type: %T, contains: %v.", rc.GetName(), rc, pretty.ToJSON(rc)) // TODO: Pass version.TransportAPI instead of relying upon the type URL v2 := r.GetTypeUrl() == version.V2RouteConfigURL @@ -96,7 +96,7 @@ func unmarshalRouteConfigResource(r *anypb.Any, logger dubboLogger.Logger) (stri // field must be empty and whose route field must be set. Inside that route // message, the cluster field will contain the clusterName or weighted clusters // we are looking for. -func generateRDSUpdateFromRouteConfiguration(rc *v3routepb.RouteConfiguration, logger dubboLogger.Logger, v2 bool) (RouteConfigUpdate, error) { +func generateRDSUpdateFromRouteConfiguration(rc *v3routepb.RouteConfiguration, logger dubbogoLogger.Logger, v2 bool) (RouteConfigUpdate, error) { vhs := make([]*VirtualHost, 0, len(rc.GetVirtualHosts())) csps := make(map[string]clusterspecifier.BalancerConfig) if envconfig.XDSRLS { @@ -231,7 +231,7 @@ func generateRetryConfig(rp *v3routepb.RetryPolicy) (*RetryConfig, error) { return cfg, nil } -func routesProtoToSlice(routes []*v3routepb.Route, csps map[string]clusterspecifier.BalancerConfig, logger dubboLogger.Logger, v2 bool) ([]*Route, map[string]bool, error) { +func routesProtoToSlice(routes []*v3routepb.Route, csps map[string]clusterspecifier.BalancerConfig, logger dubbogoLogger.Logger, v2 bool) ([]*Route, map[string]bool, error) { var routesRet []*Route var cspNames = make(map[string]bool) for _, r := range routes { @@ -422,7 +422,7 @@ func routesProtoToSlice(routes []*v3routepb.Route, csps map[string]clusterspecif return routesRet, cspNames, nil } -func hashPoliciesProtoToSlice(policies []*v3routepb.RouteAction_HashPolicy, logger dubboLogger.Logger) ([]*HashPolicy, error) { +func hashPoliciesProtoToSlice(policies []*v3routepb.RouteAction_HashPolicy, logger dubbogoLogger.Logger) ([]*HashPolicy, error) { var hashPoliciesRet []*HashPolicy for _, p := range policies { policy := HashPolicy{Terminal: p.Terminal} diff --git a/xds/resolver/watch_service.go b/xds/resolver/watch_service.go index ba64863c6c..6abd5277c5 100644 --- a/xds/resolver/watch_service.go +++ b/xds/resolver/watch_service.go @@ -30,7 +30,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" ) import ( @@ -68,7 +68,7 @@ type ldsConfig struct { // Note that during race (e.g. an xDS response is received while the user is // calling cancel()), there's a small window where the callback can be called // after the watcher is canceled. The caller needs to handle this case. -func watchService(c client.XDSClient, serviceName string, cb func(serviceUpdate, error), logger dubboLogger.Logger) (cancel func()) { +func watchService(c client.XDSClient, serviceName string, cb func(serviceUpdate, error), logger dubbogoLogger.Logger) (cancel func()) { w := &serviceUpdateWatcher{ logger: logger, c: c, @@ -83,7 +83,7 @@ func watchService(c client.XDSClient, serviceName string, cb func(serviceUpdate, // serviceUpdateWatcher handles LDS and RDS response, and calls the service // callback at the right time. type serviceUpdateWatcher struct { - logger dubboLogger.Logger + logger dubbogoLogger.Logger c client.XDSClient serviceName string ldsCancel func() diff --git a/xds/resolver/xds_resolver.go b/xds/resolver/xds_resolver.go index 3041aded24..6e9e5394f4 100644 --- a/xds/resolver/xds_resolver.go +++ b/xds/resolver/xds_resolver.go @@ -32,7 +32,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/credentials" @@ -89,7 +89,7 @@ func (b *xdsResolverBuilder) Build(t resolver.Target, cc resolver.ClientConn, op r.Close() } }() - r.logger = dubboLogger.GetLogger() + r.logger = dubbogoLogger.GetLogger() r.logger.Infof("Creating resolver for target: %+v", t) newXDSClient := newXDSClient @@ -182,7 +182,7 @@ type xdsResolver struct { cc resolver.ClientConn closed *grpcsync.Event - logger dubboLogger.Logger + logger dubbogoLogger.Logger // The underlying xdsClient which performs all xDS requests and responses. client client.XDSClient diff --git a/xds/server/listener_wrapper.go b/xds/server/listener_wrapper.go index abc668390a..cea10fcd70 100644 --- a/xds/server/listener_wrapper.go +++ b/xds/server/listener_wrapper.go @@ -36,7 +36,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/backoff" @@ -125,7 +125,7 @@ func NewListenerWrapper(params ListenerWrapperParams) (net.Listener, <-chan stru ldsUpdateCh: make(chan ldsUpdateWithError, 1), rdsUpdateCh: make(chan rdsHandlerUpdate, 1), } - lw.logger = dubboLogger.GetLogger() + lw.logger = dubbogoLogger.GetLogger() // Serve() verifies that Addr() returns a valid TCPAddr. So, it is safe to // ignore the error from SplitHostPort(). @@ -154,7 +154,7 @@ type ldsUpdateWithError struct { // particular invocation of Serve(). type listenerWrapper struct { net.Listener - logger dubboLogger.Logger + logger dubbogoLogger.Logger name string xdsCredsInUse bool diff --git a/xds/utils/balancergroup/balancergroup.go b/xds/utils/balancergroup/balancergroup.go index 9e967460ff..5b863a96ad 100644 --- a/xds/utils/balancergroup/balancergroup.go +++ b/xds/utils/balancergroup/balancergroup.go @@ -32,7 +32,7 @@ import ( ) import ( - dubboLogger "github.com/dubbogo/gost/log/logger" + dubbogoLogger "github.com/dubbogo/gost/log/logger" "google.golang.org/grpc/balancer" @@ -207,7 +207,7 @@ func (sbc *subBalancerWrapper) stopBalancer() { type BalancerGroup struct { cc balancer.ClientConn buildOpts balancer.BuildOptions - logger dubboLogger.Logger + logger dubbogoLogger.Logger // stateAggregator is where the state/picker updates will be sent to. It's // provided by the parent balancer, to build a picker with all the @@ -262,7 +262,7 @@ var DefaultSubBalancerCloseTimeout = 15 * time.Minute // New creates a new BalancerGroup. Note that the BalancerGroup // needs to be started to work. -func New(cc balancer.ClientConn, bOpts balancer.BuildOptions, stateAggregator BalancerStateAggregator, logger dubboLogger.Logger) *BalancerGroup { +func New(cc balancer.ClientConn, bOpts balancer.BuildOptions, stateAggregator BalancerStateAggregator, logger dubbogoLogger.Logger) *BalancerGroup { return &BalancerGroup{ cc: cc, buildOpts: bOpts, From 50a5f189e4250a66dc93186e8177853e6aac8b83 Mon Sep 17 00:00:00 2001 From: Leospard <694963063@qq.com> Date: Wed, 6 Jul 2022 22:45:36 +0800 Subject: [PATCH 8/8] modify import path format --- protocol/dubbo3/health/serverhealth.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protocol/dubbo3/health/serverhealth.go b/protocol/dubbo3/health/serverhealth.go index ce7f9afc1e..e14433ffd8 100644 --- a/protocol/dubbo3/health/serverhealth.go +++ b/protocol/dubbo3/health/serverhealth.go @@ -25,12 +25,13 @@ import ( ) import ( + logger "github.com/dubbogo/gost/log/logger" + "github.com/dubbogo/grpc-go/codes" "github.com/dubbogo/grpc-go/status" ) import ( - logger "github.com/dubbogo/gost/log/logger" "dubbo.apache.org/dubbo-go/v3/config" healthpb "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3/health/triple_health_v1" healthtriple "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3/health/triple_health_v1"