diff --git a/cluster/router/tag/tag_router_test.go b/cluster/router/tag/tag_router_test.go index 3f7b979f3d52d51ab50c94ea32e87b5eb4f9591e..d27e6444169781ad8287b65003370fb6eaa0d801 100644 --- a/cluster/router/tag/tag_router_test.go +++ b/cluster/router/tag/tag_router_test.go @@ -74,7 +74,6 @@ const ( var ( zkFormat = "zookeeper://%s:%d" - conditionFormat = "condition://%s/com.foo.BarService" ) // MockInvoker is only mock the Invoker to support test tagRouter diff --git a/config_center/nacos/client.go b/config_center/nacos/client.go index f3942c023d6bc7b7c7afe09863283cbc315fdb1f..c7d631c76fec07820d72a1f4065e51a018af0d29 100644 --- a/config_center/nacos/client.go +++ b/config_center/nacos/client.go @@ -18,7 +18,6 @@ package nacos import ( - "path/filepath" "strconv" "strings" "sync" @@ -38,9 +37,6 @@ import ( "github.com/apache/dubbo-go/common/logger" ) -// Nacos Log dir, it can be override when creating client by config_center.log_dir -var logDir = filepath.Join("logs", "nacos", "log") - // NacosClient Nacos client type NacosClient struct { name string diff --git a/protocol/dubbo/hessian2/const.go b/protocol/dubbo/hessian2/const.go index 74a00b601db22397916aab215ccd33bc918d91e7..0c95390fbfff152a926ca2d1ff09682a4cb893ae 100644 --- a/protocol/dubbo/hessian2/const.go +++ b/protocol/dubbo/hessian2/const.go @@ -28,11 +28,6 @@ import ( perrors "github.com/pkg/errors" ) -const ( - mask = byte(127) - flag = byte(128) -) - const ( // Zero : byte zero Zero = byte(0x00) @@ -84,10 +79,6 @@ const ( BC_LIST_FIXED = byte('V') BC_LIST_VARIABLE_UNTYPED = byte(0x57) BC_LIST_FIXED_UNTYPED = byte(0x58) - _listFixedTypedLenTagMin = byte(0x70) - _listFixedTypedLenTagMax = byte(0x77) - _listFixedUntypedLenTagMin = byte(0x78) - _listFixedUntypedLenTagMax = byte(0x7f) BC_LIST_DIRECT = byte(0x70) BC_LIST_DIRECT_UNTYPED = byte(0x78) diff --git a/protocol/dubbo/impl/const.go b/protocol/dubbo/impl/const.go index 70d8bae6cad63d436f5d9f1ef69c397ee8a052f3..492a87a194eeb9ef673f1c83a499872cfb9724cb 100644 --- a/protocol/dubbo/impl/const.go +++ b/protocol/dubbo/impl/const.go @@ -28,11 +28,6 @@ const ( DUBBO = "dubbo" ) -const ( - mask = byte(127) - flag = byte(128) -) - const ( // Zero : byte zero Zero = byte(0x00) @@ -84,10 +79,6 @@ const ( BC_LIST_FIXED = byte('V') BC_LIST_VARIABLE_UNTYPED = byte(0x57) BC_LIST_FIXED_UNTYPED = byte(0x58) - _listFixedTypedLenTagMin = byte(0x70) - _listFixedTypedLenTagMax = byte(0x77) - _listFixedUntypedLenTagMin = byte(0x78) - _listFixedUntypedLenTagMax = byte(0x7f) BC_LIST_DIRECT = byte(0x70) BC_LIST_DIRECT_UNTYPED = byte(0x78) diff --git a/protocol/dubbo/opentracing.go b/protocol/dubbo/opentracing.go index 2dcd6a4d0d9f491ba6d51ea7a3ba96812a6f9e08..f45e6fdc71af6279c2fadadd0576cde629a535e1 100644 --- a/protocol/dubbo/opentracing.go +++ b/protocol/dubbo/opentracing.go @@ -35,14 +35,6 @@ func injectTraceCtx(currentSpan opentracing.Span, inv *invocation_impl.RPCInvoca return err } -func extractTraceCtx(inv *invocation_impl.RPCInvocation) (opentracing.SpanContext, error) { - traceAttachments := filterContext(inv.Attachments()) - // actually, if user do not use any opentracing framework, the err will not be nil. - spanCtx, err := opentracing.GlobalTracer().Extract(opentracing.TextMap, - opentracing.TextMapCarrier(traceAttachments)) - return spanCtx, err -} - func filterContext(attachments map[string]interface{}) map[string]string { var traceAttchment = make(map[string]string) for k, v := range attachments { diff --git a/protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go b/protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go index 11e9b21156bdcbb51b077b5d7634a782fc27547d..78847282d5ff6c36a4fc15dee1f7bf16e8e9b8b3 100644 --- a/protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go +++ b/protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go @@ -28,19 +28,11 @@ import ( "github.com/golang/protobuf/protoc-gen-go/generator" ) -// generatedCodeVersion indicates a version of the generated code. -// It is incremented whenever an incompatibility between the generated code and -// the grpc package is introduced; the generated code references -// a constant, grpc.SupportPackageIsVersionN (where N is generatedCodeVersion). -const generatedCodeVersion = 4 - // Paths for packages used by code generated in this file, // relative to the import_prefix of the generator.Generator. const ( contextPkgPath = "context" grpcPkgPath = "google.golang.org/grpc" - codePkgPath = "google.golang.org/grpc/codes" - statusPkgPath = "google.golang.org/grpc/status" ) func init() { diff --git a/protocol/jsonrpc/json.go b/protocol/jsonrpc/json.go index 506c4c953b1b1113b43669171efdeeaeb6fca10d..57d36d2eadd761aa359d55c350772745f1cde819 100644 --- a/protocol/jsonrpc/json.go +++ b/protocol/jsonrpc/json.go @@ -53,8 +53,6 @@ const ( CodeMethodNotFound = -32601 CodeInvalidParams = -32602 CodeInternalError = -32603 - codeServerErrorStart = -32099 - codeServerErrorEnd = -32000 ) // Error response Error diff --git a/registry/kubernetes/listener_test.go b/registry/kubernetes/listener_test.go index f1d8ff41761a841aa2bec888336756854ff16874..ef6e8fb1fceed9aa84a0f9099b8c782ceb624910 100644 --- a/registry/kubernetes/listener_test.go +++ b/registry/kubernetes/listener_test.go @@ -31,138 +31,6 @@ import ( "github.com/apache/dubbo-go/remoting" ) -var clientPodJsonData = `{ - "apiVersion": "v1", - "kind": "Pod", - "metadata": { - "annotations": { - "dubbo.io/annotation": "W3siayI6Ii9kdWJibyIsInYiOiIifSx7ImsiOiIvZHViYm8vY29tLmlrdXJlbnRvLnVzZXIuVXNlclByb3ZpZGVyIiwidiI6IiJ9LHsiayI6Ii9kdWJiby9jb20uaWt1cmVudG8udXNlci5Vc2VyUHJvdmlkZXIvY29uc3VtZXJzIiwidiI6IiJ9LHsiayI6Ii9kdWJibyIsInYiOiIifSx7ImsiOiIvZHViYm8vY29tLmlrdXJlbnRvLnVzZXIuVXNlclByb3ZpZGVyIiwidiI6IiJ9LHsiayI6Ii9kdWJiby9jb20uaWt1cmVudG8udXNlci5Vc2VyUHJvdmlkZXIvcHJvdmlkZXJzIiwidiI6IiJ9LHsiayI6Ii9kdWJiby9jb20uaWt1cmVudG8udXNlci5Vc2VyUHJvdmlkZXIvY29uc3VtZXJzL2NvbnN1bWVyJTNBJTJGJTJGMTcyLjE3LjAuOCUyRlVzZXJQcm92aWRlciUzRmNhdGVnb3J5JTNEY29uc3VtZXJzJTI2ZHViYm8lM0RkdWJib2dvLWNvbnN1bWVyLTIuNi4wJTI2cHJvdG9jb2wlM0RkdWJibyIsInYiOiIifV0=" - }, - "creationTimestamp": "2020-03-13T03:38:57Z", - "labels": { - "dubbo.io/label": "dubbo.io-value" - }, - "name": "client", - "namespace": "default", - "resourceVersion": "2449700", - "selfLink": "/api/v1/namespaces/default/pods/client", - "uid": "3ec394f5-dcc6-49c3-8061-57b4b2b41344" - }, - "spec": { - "containers": [ - { - "env": [ - { - "name": "NAMESPACE", - "valueFrom": { - "fieldRef": { - "apiVersion": "v1", - "fieldPath": "metadata.namespace" - } - } - } - ], - "image": "registry.cn-hangzhou.aliyuncs.com/scottwang/dubbogo-client", - "imagePullPolicy": "Always", - "name": "client", - "resources": {}, - "terminationMessagePath": "/dev/termination-log", - "terminationMessagePolicy": "File", - "volumeMounts": [ - { - "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", - "name": "dubbo-sa-token-l2lzh", - "readOnly": true - } - ] - } - ], - "dnsPolicy": "ClusterFirst", - "enableServiceLinks": true, - "nodeName": "minikube", - "priority": 0, - "restartPolicy": "Never", - "schedulerName": "default-scheduler", - "securityContext": {}, - "serviceAccount": "dubbo-sa", - "serviceAccountName": "dubbo-sa", - "terminationGracePeriodSeconds": 30, - "tolerations": [ - { - "effect": "NoExecute", - "key": "node.kubernetes.io/not-ready", - "operator": "Exists", - "tolerationSeconds": 300 - }, - { - "effect": "NoExecute", - "key": "node.kubernetes.io/unreachable", - "operator": "Exists", - "tolerationSeconds": 300 - } - ], - "volumes": [ - { - "name": "dubbo-sa-token-l2lzh", - "secret": { - "defaultMode": 420, - "secretName": "dubbo-sa-token-l2lzh" - } - } - ] - }, - "status": { - "conditions": [ - { - "lastProbeTime": null, - "lastTransitionTime": "2020-03-13T03:38:57Z", - "status": "True", - "type": "Initialized" - }, - { - "lastProbeTime": null, - "lastTransitionTime": "2020-03-13T03:40:18Z", - "status": "True", - "type": "Ready" - }, - { - "lastProbeTime": null, - "lastTransitionTime": "2020-03-13T03:40:18Z", - "status": "True", - "type": "ContainersReady" - }, - { - "lastProbeTime": null, - "lastTransitionTime": "2020-03-13T03:38:57Z", - "status": "True", - "type": "PodScheduled" - } - ], - "containerStatuses": [ - { - "containerID": "docker://2870d6abc19ca7fe22ca635ebcfac5d48c6d5550a659bafd74fb48104f6dfe3c", - "image": "registry.cn-hangzhou.aliyuncs.com/scottwang/dubbogo-client:latest", - "imageID": "docker-pullable://registry.cn-hangzhou.aliyuncs.com/scottwang/dubbogo-client@sha256:1f075131f708a0d400339e81549d7c4d4ed917ab0b6bd38ef458dd06ad25a559", - "lastState": {}, - "name": "client", - "ready": true, - "restartCount": 0, - "state": { - "running": { - "startedAt": "2020-03-13T03:40:17Z" - } - } - } - ], - "hostIP": "10.0.2.15", - "phase": "Running", - "podIP": "172.17.0.8", - "qosClass": "BestEffort", - "startTime": "2020-03-13T03:38:57Z" - } -} -` - func Test_DataChange(t *testing.T) { listener := NewRegistryDataListener(&MockDataListener{}) url, _ := common.NewURL("jsonrpc%3A%2F%2F127.0.0.1%3A20001%2Fcom.ikurento.user.UserProvider%3Fanyhost%3Dtrue%26app.version%3D0.0.1%26application%3DBDTService%26category%3Dproviders%26cluster%3Dfailover%26dubbo%3Ddubbo-provider-golang-2.6.0%26environment%3Ddev%26group%3D%26interface%3Dcom.ikurento.user.UserProvider%26ip%3D10.32.20.124%26loadbalance%3Drandom%26methods.GetUser.loadbalance%3Drandom%26methods.GetUser.retries%3D1%26methods.GetUser.weight%3D0%26module%3Ddubbogo%2Buser-info%2Bserver%26name%3DBDTService%26organization%3Dikurento.com%26owner%3DZX%26pid%3D74500%26retries%3D0%26service.filter%3Decho%26side%3Dprovider%26timestamp%3D1560155407%26version%3D%26warmup%3D100") diff --git a/remoting/getty/getty_client.go b/remoting/getty/getty_client.go index 17b5231917b220c4e88d0103ca68dbc28be53dd9..da31c0bf4c3a0fec8284f613a6409b100ffbb12f 100644 --- a/remoting/getty/getty_client.go +++ b/remoting/getty/getty_client.go @@ -38,8 +38,6 @@ import ( ) var ( - errInvalidCodecType = perrors.New("illegal CodecType") - errInvalidAddress = perrors.New("remote address invalid or empty") errSessionNotExist = perrors.New("session not exist") errClientClosed = perrors.New("client closed") errClientReadTimeout = perrors.New("client read timeout") diff --git a/remoting/getty/opentracing.go b/remoting/getty/opentracing.go index 7db733cbe919f2bef46cfc477bda836dc2da0d45..4ba4fde9d880dee8437f8bb3dfdfec910f96fdcc 100644 --- a/remoting/getty/opentracing.go +++ b/remoting/getty/opentracing.go @@ -35,14 +35,6 @@ func injectTraceCtx(currentSpan opentracing.Span, inv *invocation_impl.RPCInvoca return err } -func extractTraceCtx(inv *invocation_impl.RPCInvocation) (opentracing.SpanContext, error) { - traceAttachments := filterContext(inv.Attachments()) - // actually, if user do not use any opentracing framework, the err will not be nil. - spanCtx, err := opentracing.GlobalTracer().Extract(opentracing.TextMap, - opentracing.TextMapCarrier(traceAttachments)) - return spanCtx, err -} - func filterContext(attachments map[string]interface{}) map[string]string { var traceAttchment = make(map[string]string) for k, v := range attachments {