You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2025/08/26 08:45:26 UTC
(dubbo-go) branch develop updated: fix(lint): delete unused code (#2984)
This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/develop by this push:
new 7f84d5dc8 fix(lint): delete unused code (#2984)
7f84d5dc8 is described below
commit 7f84d5dc862aec230e88f643add14f88d8591623
Author: marsevilspirit <ma...@gmail.com>
AuthorDate: Tue Aug 26 16:45:21 2025 +0800
fix(lint): delete unused code (#2984)
* fix(lint): delete unused code
* fix(comment): delete ai comment
* fix(comment): delete ai comment
* fix(lint): delete unused code
---
.golangci.yml | 1 +
cluster/router/chain/chain.go | 12 --
cluster/router/polaris/router.go | 7 -
config/router_config_test.go | 6 -
config_center/nacos/client.go | 1 -
config_center/nacos/impl.go | 1 -
filter/adaptivesvc/limiter/hill_climbing.go | 9 -
filter/adaptivesvc/limiter/utils.go | 7 -
filter/auth/provider_auth_filter.go | 4 -
filter/generic/util.go | 10 -
logger/logger.go | 31 ---
metadata/metadata_service.go | 60 ++----
metadata/report/zookeeper/report.go | 2 -
metrics/api.go | 1 -
metrics/registry/collector.go | 22 ---
protocol/dubbo3/common_test.go | 33 ----
protocol/dubbo3/dubbo3_invoker.go | 18 --
protocol/dubbo3/dubbo3_invoker_test.go | 8 -
protocol/triple/dubbo3_invoker.go | 18 --
protocol/triple/triple_protocol/handler.go | 24 ---
.../triple/triple_protocol/handler_ext_test.go | 1 -
protocol/triple/triple_protocol/protocol_triple.go | 3 -
protocol/triple/triple_protocol/server.go | 2 -
registry/base_registry.go | 14 +-
registry/etcdv3/listener_test.go | 13 --
registry/etcdv3/service_discovery_test.go | 13 --
registry/nacos/service_discovery_test.go | 1 -
registry/polaris/utils.go | 1 -
.../metadata_service_url_params_customizer_test.go | 66 -------
.../servicediscovery/service_discovery_registry.go | 40 ----
registry/zookeeper/registry.go | 28 ---
registry/zookeeper/service_discovery_test.go | 100 ----------
remoting/etcdv3/listener.go | 5 -
remoting/getty/getty_client_test.go | 208 ---------------------
remoting/getty/pool.go | 4 -
remoting/polaris/builder.go | 26 ---
remoting/polaris/parser/parser.go | 5 -
.../curator_discovery/service_discovery.go | 5 -
server/options.go | 2 -
server/server.go | 4 -
40 files changed, 18 insertions(+), 798 deletions(-)
diff --git a/.golangci.yml b/.golangci.yml
index 62a556a5d..7ebac8ac8 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -21,6 +21,7 @@ linters:
- ineffassign
- misspell
- staticcheck
+ - unused
settings:
depguard:
rules:
diff --git a/cluster/router/chain/chain.go b/cluster/router/chain/chain.go
index 7dfbb46e0..6821e6820 100644
--- a/cluster/router/chain/chain.go
+++ b/cluster/router/chain/chain.go
@@ -105,18 +105,6 @@ func (c *RouterChain) copyRouters() []router.PriorityRouter {
return ret
}
-// copyInvokers copies a snapshot of the received invokers.
-func (c *RouterChain) copyInvokers() []base.Invoker {
- c.mutex.RLock()
- defer c.mutex.RUnlock()
- if len(c.invokers) == 0 {
- return nil
- }
- ret := make([]base.Invoker, 0, len(c.invokers))
- ret = append(ret, c.invokers...)
- return ret
-}
-
// NewRouterChain init router chain
// Loop routerFactories and call NewRouter method
func NewRouterChain() (*RouterChain, error) {
diff --git a/cluster/router/polaris/router.go b/cluster/router/polaris/router.go
index 6bcb1f9ce..5346ccf25 100644
--- a/cluster/router/polaris/router.go
+++ b/cluster/router/polaris/router.go
@@ -18,11 +18,9 @@
package polaris
import (
- "context"
"errors"
"fmt"
"strings"
- "sync"
"time"
)
@@ -80,11 +78,6 @@ type polarisRouter struct {
routerAPI polaris.RouterAPI
consumerAPI polaris.ConsumerAPI
-
- cancel context.CancelFunc
-
- lock sync.RWMutex
- instances map[string]model.Instance
}
// Route Determine the target invokers list.
diff --git a/config/router_config_test.go b/config/router_config_test.go
index 9c85c7b64..4c6e40da1 100644
--- a/config/router_config_test.go
+++ b/config/router_config_test.go
@@ -30,12 +30,6 @@ import (
"dubbo.apache.org/dubbo-go/v3/common/constant"
)
-const (
- testDestinationRuleYML = "testdata/router_config_dest_rule.yml"
- errorTestDestinationRuleYML = "testdata/router_config_destination_rule_error.yml"
- testVirtualServiceYML = "testdata/router_config_virtual_service.yml"
-)
-
func TestString(t *testing.T) {
s := "a1=>a2"
s1 := "=>a2"
diff --git a/config_center/nacos/client.go b/config_center/nacos/client.go
index a13865e74..91c9ce4ce 100644
--- a/config_center/nacos/client.go
+++ b/config_center/nacos/client.go
@@ -35,7 +35,6 @@ import (
// NacosClient Nacos configClient
type NacosClient struct {
- name string
NacosAddrs []string
sync.Mutex // for Client
configClient *nacosClient.NacosConfigClient
diff --git a/config_center/nacos/impl.go b/config_center/nacos/impl.go
index bd8594266..00f3cc1b3 100644
--- a/config_center/nacos/impl.go
+++ b/config_center/nacos/impl.go
@@ -41,7 +41,6 @@ import (
)
const (
- nacosClientName = "nacos config_center"
// the number is a little big tricky
// it will be used in query which looks up all keys with the target group
// now, one key represents one application
diff --git a/filter/adaptivesvc/limiter/hill_climbing.go b/filter/adaptivesvc/limiter/hill_climbing.go
index 2f714ff60..f14632d5b 100644
--- a/filter/adaptivesvc/limiter/hill_climbing.go
+++ b/filter/adaptivesvc/limiter/hill_climbing.go
@@ -330,12 +330,3 @@ func (u *HillClimbingUpdater) adjustLimitation(option HillClimbingOption) error
VerboseDebugf("[HillClimbingUpdater] The limitation is update from %d to %d.", uint64(oldLimitation), uint64(limitation))
return nil
}
-
-func (u *HillClimbingUpdater) shouldDrop(lastUpdatedTime time.Time) (isDropped bool) {
- if !u.limiter.lastUpdatedTime.Load().Equal(lastUpdatedTime) {
- VerboseDebugf("[HillClimbingUpdater] The limitation is updated by others, drop this update, seq: %d.", u.seq)
- isDropped = true
- return
- }
- return
-}
diff --git a/filter/adaptivesvc/limiter/utils.go b/filter/adaptivesvc/limiter/utils.go
index d82b273ba..fabfc77c1 100644
--- a/filter/adaptivesvc/limiter/utils.go
+++ b/filter/adaptivesvc/limiter/utils.go
@@ -32,13 +32,6 @@ func VerboseDebugf(msg string, args ...any) {
logger.Debugf(msg, args...)
}
-func minUint64(lhs, rhs uint64) uint64 {
- if lhs < rhs {
- return lhs
- }
- return rhs
-}
-
func minDuration(lhs, rhs time.Duration) time.Duration {
if lhs < rhs {
return lhs
diff --git a/filter/auth/provider_auth_filter.go b/filter/auth/provider_auth_filter.go
index 5f06946e0..2a7b53611 100644
--- a/filter/auth/provider_auth_filter.go
+++ b/filter/auth/provider_auth_filter.go
@@ -76,7 +76,3 @@ func (paf *authFilter) Invoke(ctx context.Context, invoker base.Invoker, invocat
func (paf *authFilter) OnResponse(ctx context.Context, result result.Result, invoker base.Invoker, invocation base.Invocation) result.Result {
return result
}
-
-func newProviderAuthFilter() filter.Filter {
- return &authFilter{}
-}
diff --git a/filter/generic/util.go b/filter/generic/util.go
index 78142469c..2e5b22b62 100644
--- a/filter/generic/util.go
+++ b/filter/generic/util.go
@@ -53,16 +53,6 @@ func isGeneric(generic string) bool {
return lowerGeneric == constant.GenericSerializationDefault
}
-// toUnexport is to lower the first letter
-func toUnexport(a string) string {
- return strings.ToLower(a[:1]) + a[1:]
-}
-
-// toExport is to upper the first letter
-func toExport(a string) string {
- return strings.ToUpper(a[:1]) + a[1:]
-}
-
func getGeneralizer(generic string) (g generalizer.Generalizer) {
switch strings.ToLower(generic) {
case constant.GenericSerializationDefault:
diff --git a/logger/logger.go b/logger/logger.go
index 68d2dba54..88929cc51 100644
--- a/logger/logger.go
+++ b/logger/logger.go
@@ -20,9 +20,6 @@ package logger
import (
dubbogoLogger "github.com/dubbogo/gost/log/logger"
-
- "go.uber.org/zap"
- "go.uber.org/zap/zapcore"
)
var logger Logger
@@ -54,31 +51,3 @@ type OpsLogger interface {
Logger
SetLoggerLevel(level string) bool
}
-
-// 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 {
- switch c.ZapConfig.Encoding {
- case "json":
- return zapcore.NewJSONEncoder(c.ZapConfig.EncoderConfig)
- case "console":
- return zapcore.NewConsoleEncoder(c.ZapConfig.EncoderConfig)
- default:
- return nil
- }
-}
-
-// getLogWriter get Lumberjack writer by LumberjackConfig
-func (c *Config) getLogWriter() zapcore.WriteSyncer {
- return zapcore.AddSync(c.LumberjackConfig)
-}
diff --git a/metadata/metadata_service.go b/metadata/metadata_service.go
index 9e40ddcb9..d2cce72e6 100644
--- a/metadata/metadata_service.go
+++ b/metadata/metadata_service.go
@@ -37,7 +37,6 @@ import (
tripleapi "dubbo.apache.org/dubbo-go/v3/metadata/triple_api/proto"
"dubbo.apache.org/dubbo-go/v3/protocol/base"
"dubbo.apache.org/dubbo-go/v3/protocol/protocolwrapper"
- "dubbo.apache.org/dubbo-go/v3/protocol/result"
"dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
)
@@ -241,49 +240,6 @@ func (e *serviceExporter) exportV2(port string) {
//exporter.metadataService.SetMetadataServiceURL(ivkURL)
}
-// serviceInvoker, if base on server.infoInvoker will cause cycle dependency, so we need to use this way
-type serviceInvoker struct {
- *base.BaseInvoker
- invoke func(context context.Context, invocation base.Invocation) result.Result
-}
-
-func (si serviceInvoker) Invoke(context context.Context, invocation base.Invocation) result.Result {
- return si.invoke(context, invocation)
-}
-
-type MetadataServiceHandler interface {
- GetMetadataInfo(ctx context.Context, revision string) (*info.MetadataInfo, error)
-}
-
-type MetadataServiceV1 struct {
- delegate MetadataService
-}
-
-func (mtsV1 *MetadataServiceV1) GetMetadataInfo(ctx context.Context, revision string) (*info.MetadataInfo, error) {
- metadataInfo, err := mtsV1.delegate.GetMetadataInfo(revision)
- if err != nil {
- return nil, err
- }
- return metadataInfo, nil
-}
-
-func convertV1(serviceInfos map[string]*info.ServiceInfo) map[string]*tripleapi.ServiceInfo {
- serviceInfoV1s := make(map[string]*tripleapi.ServiceInfo, len(serviceInfos))
- for k, i := range serviceInfos {
- serviceInfo := &tripleapi.ServiceInfo{
- Name: i.Name,
- Group: i.Group,
- Version: i.Version,
- Protocol: i.Protocol,
- Port: 0,
- Path: i.Path,
- Params: i.Params,
- }
- serviceInfoV1s[k] = serviceInfo
- }
- return serviceInfoV1s
-}
-
// MetadataServiceV2Handler is an implementation of the org.apache.dubbo.metadata.MetadataServiceV2 service.
type MetadataServiceV2Handler interface {
GetMetadataInfo(context.Context, *tripleapi.MetadataRequest) (*tripleapi.MetadataInfoV2, error)
@@ -377,3 +333,19 @@ var MetadataServiceV2_ServiceInfo = common.ServiceInfo{
},
},
}
+
+// MetadataServiceV1Handler
+// Compatible with V1 interface definition
+// Note: V1 method signatures differ from V2
+type MetadataServiceHandler interface {
+ GetMetadataInfo(ctx context.Context, revision string) (*info.MetadataInfo, error)
+}
+
+// Minimal implementation of MetadataServiceV1 for exporting triple v1.
+type MetadataServiceV1 struct {
+ delegate MetadataService
+}
+
+func (mtsV1 *MetadataServiceV1) GetMetadataInfo(ctx context.Context, revision string) (*info.MetadataInfo, error) {
+ return mtsV1.delegate.GetMetadataInfo(revision)
+}
diff --git a/metadata/report/zookeeper/report.go b/metadata/report/zookeeper/report.go
index e5e6d3d13..0cdb0adc8 100644
--- a/metadata/report/zookeeper/report.go
+++ b/metadata/report/zookeeper/report.go
@@ -43,8 +43,6 @@ import (
"dubbo.apache.org/dubbo-go/v3/remoting/zookeeper"
)
-var emptyStrSlice = make([]string, 0)
-
func init() {
mf := &zookeeperMetadataReportFactory{}
extension.SetMetadataReportFactory("zookeeper", func() report.MetadataReportFactory {
diff --git a/metrics/api.go b/metrics/api.go
index 6a1f51907..ea30082b8 100644
--- a/metrics/api.go
+++ b/metrics/api.go
@@ -142,7 +142,6 @@ func NewMetricIdByLabels(key *MetricKey, labels map[string]string) *MetricId {
// not an intermediate result(like summary,histogram they will export to a set of MetricSample)
type MetricSample struct {
*MetricId
- value float64
}
// CounterMetric counter metric
diff --git a/metrics/registry/collector.go b/metrics/registry/collector.go
index 4a75e0668..4d5bf722b 100644
--- a/metrics/registry/collector.go
+++ b/metrics/registry/collector.go
@@ -89,28 +89,6 @@ func (rc *registryCollector) notifyHandler(event *RegistryMetricsEvent) {
rc.R.Rt(metrics.NewMetricId(NotifyRt, level), &metrics.RtOpts{}).Observe(event.CostMs())
}
-// directoryHandler handles directory metrics
-func (rc *registryCollector) directoryHandler(event *RegistryMetricsEvent) {
- // Event is converted to metrics
- // Save metrics to the MetricRegistry
- level := metrics.GetApplicationLevel()
- typ := event.Attachment["DirTyp"]
- switch typ {
- case NumAllInc:
- rc.R.Gauge(metrics.NewMetricId(DirectoryMetricNumAll, level)).Inc()
- case NumAllDec:
- rc.R.Gauge(metrics.NewMetricId(DirectoryMetricNumAll, level)).Add(-1)
- case NumDisableTotal:
- rc.R.Gauge(metrics.NewMetricId(DirectoryMetricNumDisable, level)).Inc()
- case NumToReconnectTotal:
- rc.R.Gauge(metrics.NewMetricId(DirectoryMetricNumToReconnect, level)).Inc()
- case NumValidTotal:
- rc.R.Gauge(metrics.NewMetricId(DirectoryMetricNumValid, level)).Inc()
- default:
- }
-
-}
-
// serverRegHandler handles server register metrics
func (rc *registryCollector) serverRegHandler(event *RegistryMetricsEvent) {
// Event is converted to metrics
diff --git a/protocol/dubbo3/common_test.go b/protocol/dubbo3/common_test.go
index 643e0e041..3a16f69c3 100644
--- a/protocol/dubbo3/common_test.go
+++ b/protocol/dubbo3/common_test.go
@@ -22,14 +22,9 @@ import (
"fmt"
)
-import (
- native_grpc "github.com/dubbogo/grpc-go"
-)
-
import (
"dubbo.apache.org/dubbo-go/v3/config"
"dubbo.apache.org/dubbo-go/v3/protocol/dubbo3/internal"
- "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
)
// TODO: After the config is removed, remove the test
@@ -50,31 +45,3 @@ func (g *greeterProvider) SayHello(ctx context.Context, req *internal.HelloReque
fmt.Printf("req: %v", req)
return &internal.HelloReply{Message: "this is message from reply"}, nil
}
-
-func dubboGreeterSayHelloHandler(srv any, ctx context.Context,
- dec func(any) error, interceptor native_grpc.UnaryServerInterceptor) (any, error) {
-
- in := new(internal.HelloRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- base := srv.(Dubbo3GrpcService)
-
- args := []any{}
- args = append(args, in)
- invo := invocation.NewRPCInvocation("SayHello", args, nil)
-
- if interceptor == nil {
- result := base.XXX_GetProxyImpl().Invoke(context.Background(), invo)
- return result.Result(), result.Error()
- }
- info := &native_grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/helloworld.Greeter/SayHello",
- }
- handler := func(context.Context, any) (any, error) {
- result := base.XXX_GetProxyImpl().Invoke(context.Background(), invo)
- return result.Result(), result.Error()
- }
- return interceptor(ctx, in, info, handler)
-}
diff --git a/protocol/dubbo3/dubbo3_invoker.go b/protocol/dubbo3/dubbo3_invoker.go
index b6f18d2e8..8b3ffc69a 100644
--- a/protocol/dubbo3/dubbo3_invoker.go
+++ b/protocol/dubbo3/dubbo3_invoker.go
@@ -21,8 +21,6 @@ import (
"context"
"errors"
"reflect"
- "strconv"
- "strings"
"sync"
"time"
)
@@ -45,7 +43,6 @@ import (
"dubbo.apache.org/dubbo-go/v3/config"
"dubbo.apache.org/dubbo-go/v3/global"
"dubbo.apache.org/dubbo-go/v3/protocol/base"
- "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
"dubbo.apache.org/dubbo-go/v3/protocol/result"
dubbotls "dubbo.apache.org/dubbo-go/v3/tls"
)
@@ -269,21 +266,6 @@ func (di *DubboInvoker) Invoke(ctx context.Context, invocation base.Invocation)
return &result
}
-// get timeout including methodConfig
-func (di *DubboInvoker) getTimeout(invocation *invocation.RPCInvocation) time.Duration {
- timeout := di.GetURL().GetParam(strings.Join([]string{constant.MethodKeys, invocation.MethodName(), constant.TimeoutKey}, "."), "")
- if len(timeout) != 0 {
- if t, err := time.ParseDuration(timeout); err == nil {
- // config timeout into attachment
- invocation.SetAttachment(constant.TimeoutKey, strconv.Itoa(int(t.Milliseconds())))
- return t
- }
- }
- // set timeout into invocation at method level
- invocation.SetAttachment(constant.TimeoutKey, strconv.Itoa(int(di.timeout.Milliseconds())))
- return di.timeout
-}
-
// IsAvailable check if invoker is available, now it is useless
func (di *DubboInvoker) IsAvailable() bool {
client := di.getClient()
diff --git a/protocol/dubbo3/dubbo3_invoker_test.go b/protocol/dubbo3/dubbo3_invoker_test.go
index 9b04f8cb1..90eecc414 100644
--- a/protocol/dubbo3/dubbo3_invoker_test.go
+++ b/protocol/dubbo3/dubbo3_invoker_test.go
@@ -17,14 +17,6 @@
package dubbo3
-const (
- mockDubbo3CommonUrl2 = "tri://127.0.0.1:20003/DubboGreeterImpl?accesslog=&anyhost=true&app.version=0.0.1&application=BDTService&async=false&bean.name=greeterImpl" +
- "&category=providers&cluster=failover&dubbo=dubbo-provider-golang-2.6.0&environment=dev&execute.limit=&execute.limit.rejected.handler=&generic=false&group=&interface=org.apache.dubbo.DubboGreeterImpl" +
- "&ip=192.168.1.106&loadbalance=random&methods.SayHello.loadbalance=random&methods.SayHello.retries=1&methods.SayHello.tps.limit.interval=&methods.SayHello.tps.limit.rate=&methods.SayHello.tps.limit.strategy=" +
- "&methods.SayHello.weight=0&module=dubbogo+say-hello+client&name=BDTService&organization=ikurento.com&owner=ZX&pid=49427&reference.filter=cshutdown®istry.role=3&remote.timestamp=1576923717&retries=" +
- "&service.filter=echo%2Ctoken%2Caccesslog%2Ctps%2Cexecute%2Cpshutdown&side=provider×tamp=1576923740&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&version=&warmup=100!"
-)
-
//func TestInvoke(t *testing.T) {
// go internal.InitDubboServer()
// time.Sleep(time.Second * 3)
diff --git a/protocol/triple/dubbo3_invoker.go b/protocol/triple/dubbo3_invoker.go
index 48be3cd8e..262d6f91f 100644
--- a/protocol/triple/dubbo3_invoker.go
+++ b/protocol/triple/dubbo3_invoker.go
@@ -21,8 +21,6 @@ import (
"context"
"errors"
"reflect"
- "strconv"
- "strings"
"sync"
"time"
)
@@ -45,7 +43,6 @@ import (
"dubbo.apache.org/dubbo-go/v3/config"
"dubbo.apache.org/dubbo-go/v3/global"
"dubbo.apache.org/dubbo-go/v3/protocol/base"
- "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
"dubbo.apache.org/dubbo-go/v3/protocol/result"
dubbotls "dubbo.apache.org/dubbo-go/v3/tls"
)
@@ -267,21 +264,6 @@ func (di *DubboInvoker) Invoke(ctx context.Context, invocation base.Invocation)
return &result
}
-// get timeout including methodConfig
-func (di *DubboInvoker) getTimeout(inv *invocation.RPCInvocation) time.Duration {
- timeout := di.GetURL().GetParam(strings.Join([]string{constant.MethodKeys, inv.MethodName(), constant.TimeoutKey}, "."), "")
- if len(timeout) != 0 {
- if t, err := time.ParseDuration(timeout); err == nil {
- // config timeout into attachment
- inv.SetAttachment(constant.TimeoutKey, strconv.Itoa(int(t.Milliseconds())))
- return t
- }
- }
- // set timeout into invocation at method level
- inv.SetAttachment(constant.TimeoutKey, strconv.Itoa(int(di.timeout.Milliseconds())))
- return di.timeout
-}
-
// IsAvailable check if invoker is available, now it is useless
func (di *DubboInvoker) IsAvailable() bool {
client := di.getClient()
diff --git a/protocol/triple/triple_protocol/handler.go b/protocol/triple/triple_protocol/handler.go
index 773c887d0..1529485cd 100644
--- a/protocol/triple/triple_protocol/handler.go
+++ b/protocol/triple/triple_protocol/handler.go
@@ -462,27 +462,3 @@ func (c *handlerConfig) newProtocolHandlers(streamType StreamType) []protocolHan
func getIdentifier(group, version string) string {
return group + "/" + version
}
-
-func newStreamHandler(
- procedure string,
- streamType StreamType,
- implementation StreamingHandlerFunc,
- options ...HandlerOption,
-) *Handler {
- config := newHandlerConfig(procedure, options)
- if ic := config.Interceptor; ic != nil {
- implementation = ic.WrapStreamingHandler(implementation)
- }
- protocolHandlers := config.newProtocolHandlers(streamType)
-
- hdl := &Handler{
- spec: config.newSpec(streamType),
- implementations: make(map[string]StreamingHandlerFunc, defaultImplementationsSize),
- protocolHandlers: protocolHandlers,
- allowMethod: sortedAllowMethodValue(protocolHandlers),
- acceptPost: sortedAcceptPostValue(protocolHandlers),
- }
- hdl.processImplementation(getIdentifier(config.Group, config.Version), implementation)
-
- return hdl
-}
diff --git a/protocol/triple/triple_protocol/handler_ext_test.go b/protocol/triple/triple_protocol/handler_ext_test.go
index 90e6ef4ac..c3c0580a9 100644
--- a/protocol/triple/triple_protocol/handler_ext_test.go
+++ b/protocol/triple/triple_protocol/handler_ext_test.go
@@ -36,7 +36,6 @@ func TestHandler_ServeHTTP(t *testing.T) {
successPingServer{},
))
const pingProcedure = "/" + pingv1connect.PingServiceName + "/Ping"
- const sumProcedure = "/" + pingv1connect.PingServiceName + "/Sum"
server := httptest.NewServer(mux)
client := server.Client()
t.Cleanup(func() {
diff --git a/protocol/triple/triple_protocol/protocol_triple.go b/protocol/triple/triple_protocol/protocol_triple.go
index c5a6124dd..c9532e553 100644
--- a/protocol/triple/triple_protocol/protocol_triple.go
+++ b/protocol/triple/triple_protocol/protocol_triple.go
@@ -537,9 +537,6 @@ func (m *tripleUnaryMarshaler) write(data []byte) *Error {
type tripleUnaryRequestMarshaler struct {
tripleUnaryMarshaler
-
- stableCodec stableCodec
- duplexCall *duplexHTTPCall
}
func (m *tripleUnaryRequestMarshaler) Marshal(message any) *Error {
diff --git a/protocol/triple/triple_protocol/server.go b/protocol/triple/triple_protocol/server.go
index 9a85e473e..1346f9b0c 100644
--- a/protocol/triple/triple_protocol/server.go
+++ b/protocol/triple/triple_protocol/server.go
@@ -22,7 +22,6 @@ import (
"crypto/tls"
"fmt"
"net/http"
- "sync"
)
import (
@@ -45,7 +44,6 @@ import (
)
type Server struct {
- mu sync.Mutex
addr string
mux *http.ServeMux
handlers map[string]*Handler
diff --git a/registry/base_registry.go b/registry/base_registry.go
index 40c7675fb..c0f622988 100644
--- a/registry/base_registry.go
+++ b/registry/base_registry.go
@@ -20,7 +20,6 @@ package registry
import (
"fmt"
"net/url"
- "os"
"strconv"
"strings"
"sync"
@@ -46,12 +45,10 @@ const (
)
var (
- processID = ""
- localIP = ""
+ localIP = ""
)
func init() {
- processID = fmt.Sprintf("%d", os.Getpid())
localIP = common.GetLocalIp()
}
@@ -328,15 +325,6 @@ func (r *BaseRegistry) consumerRegistry(c *common.URL, params url.Values, f crea
return dubboPath, rawURL, nil
}
-// sleepWait...
-func sleepWait(n int) {
- wait := time.Duration((n + 1) * 2e8)
- if wait > MaxWaitInterval {
- wait = MaxWaitInterval
- }
- time.Sleep(wait)
-}
-
// Subscribe :subscribe from registry, event will notify by notifyListener
func (r *BaseRegistry) Subscribe(url *common.URL, notifyListener NotifyListener) error {
for {
diff --git a/registry/etcdv3/listener_test.go b/registry/etcdv3/listener_test.go
index b681a8e9d..4a7223ba4 100644
--- a/registry/etcdv3/listener_test.go
+++ b/registry/etcdv3/listener_test.go
@@ -18,7 +18,6 @@
package etcdv3
import (
- "dubbo.apache.org/dubbo-go/v3/common"
"dubbo.apache.org/dubbo-go/v3/config_center"
)
@@ -26,18 +25,6 @@ type MockDataListener struct{}
func (*MockDataListener) Process(configType *config_center.ConfigChangeEvent) {}
-type dataListenerFields struct {
- interestedURL []*common.URL
- listener config_center.ConfigurationListener
-}
-
-func newDataListener(listenerFields dataListenerFields) *dataListener {
- return &dataListener{
- interestedURL: listenerFields.interestedURL,
- listener: listenerFields.listener,
- }
-}
-
/*
func Test_dataListener_DataChange(t *testing.T) {
tests := []struct {
diff --git a/registry/etcdv3/service_discovery_test.go b/registry/etcdv3/service_discovery_test.go
index 9b5889dca..175cc488f 100644
--- a/registry/etcdv3/service_discovery_test.go
+++ b/registry/etcdv3/service_discovery_test.go
@@ -19,7 +19,6 @@ package etcdv3
import (
"context"
- "sync"
"testing"
)
@@ -92,18 +91,6 @@ func TestFunction(t *testing.T) {
assert.NoError(t, err)
}
-type testNotify struct {
- wg *sync.WaitGroup
- t *testing.T
-}
-
-func (tn *testNotify) Notify(e *registry.ServiceEvent) {
- assert.Equal(tn.t, "2233", e.Service.Port)
- tn.wg.Done()
-}
-
-func (tn *testNotify) NotifyAll([]*registry.ServiceEvent, func()) {}
-
type mockProtocol struct{}
func (m mockProtocol) Export(base.Invoker) base.Exporter {
diff --git a/registry/nacos/service_discovery_test.go b/registry/nacos/service_discovery_test.go
index 69b7fbd31..10924c46e 100644
--- a/registry/nacos/service_discovery_test.go
+++ b/registry/nacos/service_discovery_test.go
@@ -285,7 +285,6 @@ func (tn *testNotify) Notify(e *registry.ServiceEvent) {
func (tn *testNotify) NotifyAll([]*registry.ServiceEvent, func()) {}
type mockClient struct {
- instance []any
}
func (c mockClient) RegisterInstance(param vo.RegisterInstanceParam) (bool, error) {
diff --git a/registry/polaris/utils.go b/registry/polaris/utils.go
index cdd6d97d1..c291ad401 100644
--- a/registry/polaris/utils.go
+++ b/registry/polaris/utils.go
@@ -30,7 +30,6 @@ import (
type PolarisInstanceInfo struct {
instance registry.ServiceInstance
- url *common.URL
}
func getInstanceKey(namespace string, instance registry.ServiceInstance) string {
diff --git a/registry/servicediscovery/customizer/metadata_service_url_params_customizer_test.go b/registry/servicediscovery/customizer/metadata_service_url_params_customizer_test.go
index daf740d9c..7ed37cadd 100644
--- a/registry/servicediscovery/customizer/metadata_service_url_params_customizer_test.go
+++ b/registry/servicediscovery/customizer/metadata_service_url_params_customizer_test.go
@@ -28,7 +28,6 @@ import (
)
import (
- "dubbo.apache.org/dubbo-go/v3/common"
"dubbo.apache.org/dubbo-go/v3/registry"
)
@@ -44,68 +43,3 @@ func createInstance() registry.ServiceInstance {
ins := ®istry.DefaultServiceInstance{}
return ins
}
-
-type mockMetadataService struct {
- urls []any
-}
-
-func (m *mockMetadataService) Reference() string {
- panic("implement me")
-}
-
-func (m *mockMetadataService) ServiceName() (string, error) {
- panic("implement me")
-}
-
-func (m *mockMetadataService) ExportURL(*common.URL) (bool, error) {
- panic("implement me")
-}
-
-func (m *mockMetadataService) UnexportURL(*common.URL) error {
- panic("implement me")
-}
-
-func (m *mockMetadataService) SubscribeURL(*common.URL) (bool, error) {
- panic("implement me")
-}
-
-func (m *mockMetadataService) UnsubscribeURL(*common.URL) error {
- panic("implement me")
-}
-
-func (m *mockMetadataService) PublishServiceDefinition(*common.URL) error {
- panic("implement me")
-}
-
-func (m *mockMetadataService) GetExportedURLs(string, string, string, string) ([]any, error) {
- return m.urls, nil
-}
-
-func (m *mockMetadataService) MethodMapper() map[string]string {
- panic("implement me")
-}
-
-func (m *mockMetadataService) GetSubscribedURLs() ([]*common.URL, error) {
- var res []*common.URL
- for _, ui := range m.urls {
- u, _ := common.NewURL(ui.(string))
- res = append(res, u)
- }
- return res, nil
-}
-
-func (m *mockMetadataService) GetServiceDefinition(string, string, string) (string, error) {
- panic("implement me")
-}
-
-func (m *mockMetadataService) GetServiceDefinitionByServiceKey(string) (string, error) {
- panic("implement me")
-}
-
-func (m *mockMetadataService) RefreshMetadata(string, string) (bool, error) {
- panic("implement me")
-}
-
-func (m *mockMetadataService) Version() (string, error) {
- return "1.0.0", nil
-}
diff --git a/registry/servicediscovery/service_discovery_registry.go b/registry/servicediscovery/service_discovery_registry.go
index 60014ec25..3e5c50ecd 100644
--- a/registry/servicediscovery/service_discovery_registry.go
+++ b/registry/servicediscovery/service_discovery_registry.go
@@ -18,7 +18,6 @@
package servicediscovery
import (
- "bytes"
"strconv"
"strings"
"sync"
@@ -45,7 +44,6 @@ import (
metricsRegistry "dubbo.apache.org/dubbo-go/v3/metrics/registry"
"dubbo.apache.org/dubbo-go/v3/registry"
_ "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery/customizer"
- "dubbo.apache.org/dubbo-go/v3/registry/servicediscovery/synthesizer"
)
func init() {
@@ -294,44 +292,6 @@ func (s *serviceDiscoveryRegistry) LoadSubscribeInstances(url *common.URL, notif
return nil
}
-func getUrlKey(url *common.URL) string {
- var bf bytes.Buffer
- if len(url.Protocol) != 0 {
- bf.WriteString(url.Protocol)
- bf.WriteString("://")
- }
- if len(url.Location) != 0 {
- bf.WriteString(url.Location)
- bf.WriteString(":")
- bf.WriteString(url.Port)
- }
- if len(url.Path) != 0 {
- bf.WriteString("/")
- bf.WriteString(url.Path)
- }
- bf.WriteString("?")
- appendParam(bf, constant.VersionKey, url)
- appendParam(bf, constant.GroupKey, url)
- appendParam(bf, constant.NacosProtocolKey, url)
- return bf.String()
-}
-
-func appendParam(buffer bytes.Buffer, paramKey string, url *common.URL) {
- buffer.WriteString(paramKey)
- buffer.WriteString("=")
- buffer.WriteString(url.GetParam(paramKey, ""))
-}
-
-func (s *serviceDiscoveryRegistry) synthesizeSubscribedURLs(subscribedURL *common.URL, serviceInstances []registry.ServiceInstance) []*common.URL {
- var urls []*common.URL
- for _, syn := range synthesizer.GetAllSynthesizer() {
- if syn.Support(subscribedURL) {
- urls = append(urls, syn.Synthesize(subscribedURL, serviceInstances)...)
- }
- }
- return urls
-}
-
func shouldSubscribe(url *common.URL) bool {
return !shouldRegister(url)
}
diff --git a/registry/zookeeper/registry.go b/registry/zookeeper/registry.go
index 6245f6ac5..df95e6e40 100644
--- a/registry/zookeeper/registry.go
+++ b/registry/zookeeper/registry.go
@@ -22,7 +22,6 @@ import (
"net/url"
"path"
"sync"
- "time"
)
import (
@@ -84,33 +83,11 @@ func newZkRegistry(url *common.URL) (registry.Registry, error) {
// Options defines optional parameters to construct a zkRegistry (used in tests/mocks).
type Options struct {
- client *gxzookeeper.ZookeeperClient
}
// Option mutates Options when constructing a zkRegistry (functional options pattern).
type Option func(*Options)
-func newMockZkRegistry(url *common.URL, opts ...gxzookeeper.Option) (*zk.TestCluster, *zkRegistry, error) {
- var (
- err error
- r *zkRegistry
- c *zk.TestCluster
- )
-
- r = &zkRegistry{
- zkPath: make(map[string]int),
- }
- r.InitBaseRegistry(url, r)
- c, r.client, _, err = gxzookeeper.NewMockZookeeperClient("test", 15*time.Second, opts...)
- if err != nil {
- return nil, nil, err
- }
- r.WaitGroup().Add(1)
- go zookeeper.HandleClientRestart(r)
- r.InitListeners()
- return c, r, nil
-}
-
// InitListeners initializes listeners of zookeeper registry center
func (r *zkRegistry) InitListeners() {
r.listener = zookeeper.NewZkEventListener(r.client)
@@ -320,8 +297,3 @@ func (r *zkRegistry) getCloseListener(conf *common.URL) (*RegistryConfigurationL
return zkListener, nil
}
-
-func (r *zkRegistry) handleClientRestart() {
- r.WaitGroup().Add(1)
- go zookeeper.HandleClientRestart(r)
-}
diff --git a/registry/zookeeper/service_discovery_test.go b/registry/zookeeper/service_discovery_test.go
index 8fe1bf756..cfeec8328 100644
--- a/registry/zookeeper/service_discovery_test.go
+++ b/registry/zookeeper/service_discovery_test.go
@@ -18,23 +18,16 @@
package zookeeper
import (
- "context"
- "sync"
"testing"
)
import (
- "github.com/nacos-group/nacos-sdk-go/v2/model"
- "github.com/nacos-group/nacos-sdk-go/v2/vo"
-
"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/base"
- "dubbo.apache.org/dubbo-go/v3/protocol/result"
"dubbo.apache.org/dubbo-go/v3/registry"
)
@@ -51,96 +44,3 @@ func Test_zookeeperServiceDiscovery_DataChange(t *testing.T) {
serviceDiscovery := &zookeeperServiceDiscovery{}
assert.Equal(t, registry.DefaultPageSize, serviceDiscovery.GetDefaultPageSize())
}
-
-type testNotify struct {
- wg *sync.WaitGroup
- t *testing.T
-}
-
-func (tn *testNotify) Notify(e *registry.ServiceEvent) {
- assert.Equal(tn.t, "2181", e.Service.Port)
- tn.wg.Done()
-}
-
-func (tn *testNotify) NotifyAll([]*registry.ServiceEvent, func()) {}
-
-type mockClient struct {
- instance []any
-}
-
-func (c mockClient) RegisterInstance(param vo.RegisterInstanceParam) (bool, error) {
- return true, nil
-}
-
-func (c mockClient) DeregisterInstance(param vo.DeregisterInstanceParam) (bool, error) {
- return true, nil
-}
-
-func (c mockClient) UpdateInstance(param vo.UpdateInstanceParam) (bool, error) {
- return true, nil
-}
-
-func (c mockClient) GetService(param vo.GetServiceParam) (model.Service, error) {
- panic("implement me")
-}
-
-func (c mockClient) SelectInstances(param vo.SelectInstancesParam) ([]model.Instance, error) {
- panic("implement me")
-}
-
-func (c mockClient) SelectAllInstances(param vo.SelectAllInstancesParam) ([]model.Instance, error) {
- panic("implement me")
-}
-
-func (c mockClient) SelectOneHealthyInstance(param vo.SelectOneHealthInstanceParam) (*model.Instance, error) {
- panic("implement me")
-}
-
-func (c mockClient) Subscribe(param *vo.SubscribeParam) error {
- return nil
-}
-
-func (c mockClient) Unsubscribe(param *vo.SubscribeParam) error {
- panic("implement me")
-}
-
-func (c mockClient) GetAllServicesInfo(param vo.GetAllServiceInfoParam) (model.ServiceList, error) {
- panic("implement me")
-}
-
-type mockProtocol struct{}
-
-func (m mockProtocol) Export(base.Invoker) base.Exporter {
- panic("implement me")
-}
-
-func (m mockProtocol) Refer(*common.URL) base.Invoker {
- return &mockInvoker{}
-}
-
-func (m mockProtocol) Destroy() {
- panic("implement me")
-}
-
-type mockInvoker struct{}
-
-func (m *mockInvoker) GetURL() *common.URL {
- panic("implement me")
-}
-
-func (m *mockInvoker) IsAvailable() bool {
- panic("implement me")
-}
-
-func (m *mockInvoker) Destroy() {
- panic("implement me")
-}
-
-func (m *mockInvoker) Invoke(context.Context, base.Invocation) result.Result {
- return &result.RPCResult{
- Rest: &mockResult{},
- }
-}
-
-type mockResult struct {
-}
diff --git a/remoting/etcdv3/listener.go b/remoting/etcdv3/listener.go
index 7ab51b838..a4a0be74d 100644
--- a/remoting/etcdv3/listener.go
+++ b/remoting/etcdv3/listener.go
@@ -19,7 +19,6 @@ package etcdv3
import (
"sync"
- "time"
)
import (
@@ -173,10 +172,6 @@ func (l *EventListener) ListenServiceNodeEventWithPrefix(prefix string, listener
}
}
-func timeSecondDuration(sec int) time.Duration {
- return time.Duration(sec) * time.Second
-}
-
// ListenServiceEvent is invoked by etcdv3 ConsumerRegistry::Registe/ etcdv3 ConsumerRegistry::get/etcdv3 ConsumerRegistry::getListener
// registry.go:Listen -> listenServiceEvent -> listenDirEvent -> listenServiceNodeEvent
// registry.go:Listen -> listenServiceEvent -> listenServiceNodeEvent
diff --git a/remoting/getty/getty_client_test.go b/remoting/getty/getty_client_test.go
index 1265d5940..574ab6ad1 100644
--- a/remoting/getty/getty_client_test.go
+++ b/remoting/getty/getty_client_test.go
@@ -50,7 +50,6 @@ func TestRunSuite(t *testing.T) {
client := getClient(url)
assert.NotNil(t, client)
testRequestOneWay(t, client)
- //testClient_Call(t, client)
testClient_AsyncCall(t, client)
svr.Stop()
}
@@ -92,213 +91,6 @@ func getClient(url *common.URL) *Client {
return client
}
-func testClient_Call(t *testing.T, c *Client) {
- testGetBigPkg(t, c)
- testGetUser(t, c)
- testGetUser0(t, c)
- testGetUser1(t, c)
- testGetUser2(t, c)
- testGetUser3(t, c)
- testGetUser4(t, c)
- testGetUser5(t, c)
- testGetUser6(t, c)
- testGetUser61(t, c)
-}
-
-func testGetBigPkg(t *testing.T, c *Client) {
- user := &User{}
- request := remoting.NewRequest("2.0.2")
- invocation := createInvocation("GetBigPkg", nil, nil, []any{[]any{nil}, user},
- []reflect.Value{reflect.ValueOf([]any{nil}), reflect.ValueOf(user)})
- attachment := map[string]string{InterfaceKey: "com.ikurento.user.UserProvider"}
- setAttachment(invocation, attachment)
- request.Data = invocation
- request.Event = false
- request.TwoWay = true
- pendingResponse := remoting.NewPendingResponse(request.ID)
- pendingResponse.Reply = user
- remoting.AddPendingResponse(pendingResponse)
- err := c.Request(request, 8*time.Second, pendingResponse)
- assert.NoError(t, err)
- assert.NotEqual(t, "", user.ID)
- assert.NotEqual(t, "", user.Name)
-}
-
-func testGetUser(t *testing.T, c *Client) {
- user := &User{}
- request := remoting.NewRequest("2.0.2")
- invocation := createInvocation("GetUser", nil, nil, []any{"1", "username"},
- []reflect.Value{reflect.ValueOf("1"), reflect.ValueOf("username")})
- attachment := map[string]string{InterfaceKey: "com.ikurento.user.UserProvider"}
- setAttachment(invocation, attachment)
- request.Data = invocation
- request.Event = false
- request.TwoWay = true
- pendingResponse := remoting.NewPendingResponse(request.ID)
- pendingResponse.Reply = user
- remoting.AddPendingResponse(pendingResponse)
- err := c.Request(request, 3*time.Second, pendingResponse)
- assert.NoError(t, err)
- assert.Equal(t, User{ID: "1", Name: "username"}, *user)
-}
-
-func testGetUser0(t *testing.T, c *Client) {
- var (
- user *User
- err error
- )
- user = &User{}
- request := remoting.NewRequest("2.0.2")
- invocation := createInvocation("GetUser0", nil, nil, []any{"1", nil, "username"},
- []reflect.Value{reflect.ValueOf("1"), reflect.ValueOf(nil), reflect.ValueOf("username")})
- attachment := map[string]string{InterfaceKey: "com.ikurento.user.UserProvider"}
- setAttachment(invocation, attachment)
- request.Data = invocation
- request.Event = false
- request.TwoWay = true
- rsp := remoting.NewPendingResponse(request.ID)
- rsp.SetResponse(remoting.NewResponse(request.ID, "2.0.2"))
- remoting.AddPendingResponse(rsp)
- rsp.Reply = user
- err = c.Request(request, 3*time.Second, rsp)
- assert.NoError(t, err)
- assert.Equal(t, User{ID: "1", Name: "username"}, *user)
-}
-
-func testGetUser1(t *testing.T, c *Client) {
- var err error
- request := remoting.NewRequest("2.0.2")
- invocation := createInvocation("GetUser1", nil, nil, []any{},
- []reflect.Value{})
- attachment := map[string]string{InterfaceKey: "com.ikurento.user.UserProvider"}
- setAttachment(invocation, attachment)
- request.Data = invocation
- request.Event = false
- request.TwoWay = true
- pendingResponse := remoting.NewPendingResponse(request.ID)
- user := &User{}
- pendingResponse.Reply = user
- remoting.AddPendingResponse(pendingResponse)
- err = c.Request(request, 3*time.Second, pendingResponse)
- assert.NoError(t, err)
-}
-
-func testGetUser2(t *testing.T, c *Client) {
- var err error
- request := remoting.NewRequest("2.0.2")
- invocation := createInvocation("GetUser2", nil, nil, []any{},
- []reflect.Value{})
- attachment := map[string]string{InterfaceKey: "com.ikurento.user.UserProvider"}
- setAttachment(invocation, attachment)
- request.Data = invocation
- request.Event = false
- request.TwoWay = true
- pendingResponse := remoting.NewPendingResponse(request.ID)
- remoting.AddPendingResponse(pendingResponse)
- err = c.Request(request, 3*time.Second, pendingResponse)
- assert.EqualError(t, err, "error")
-}
-
-func testGetUser3(t *testing.T, c *Client) {
- var err error
- request := remoting.NewRequest("2.0.2")
- invocation := createInvocation("GetUser3", nil, nil, []any{},
- []reflect.Value{})
- attachment := map[string]string{
- InterfaceKey: "com.ikurento.user.UserProvider",
- }
- setAttachment(invocation, attachment)
- request.Data = invocation
- request.Event = false
- request.TwoWay = true
- pendingResponse := remoting.NewPendingResponse(request.ID)
- user2 := []any{}
- pendingResponse.Reply = &user2
- remoting.AddPendingResponse(pendingResponse)
- err = c.Request(request, 3*time.Second, pendingResponse)
- assert.NoError(t, err)
- assert.Equal(t, &User{ID: "1", Name: "username"}, user2[0])
-}
-
-func testGetUser4(t *testing.T, c *Client) {
- var err error
- request := remoting.NewRequest("2.0.2")
- invocation := invocation.NewRPCInvocation("GetUser4", []any{[]any{"1", "username"}}, nil)
- attachment := map[string]string{InterfaceKey: "com.ikurento.user.UserProvider"}
- setAttachment(invocation, attachment)
- request.Data = invocation
- request.Event = false
- request.TwoWay = true
- pendingResponse := remoting.NewPendingResponse(request.ID)
- user2 := []any{}
- pendingResponse.Reply = &user2
- remoting.AddPendingResponse(pendingResponse)
- err = c.Request(request, 3*time.Second, pendingResponse)
- assert.NoError(t, err)
- assert.Equal(t, &User{ID: "1", Name: "username"}, user2[0])
-}
-
-func testGetUser5(t *testing.T, c *Client) {
- var err error
- request := remoting.NewRequest("2.0.2")
- invocation := invocation.NewRPCInvocation("GetUser5", []any{map[any]any{"id": "1", "name": "username"}}, nil)
- attachment := map[string]string{InterfaceKey: "com.ikurento.user.UserProvider"}
- setAttachment(invocation, attachment)
- request.Data = invocation
- request.Event = false
- request.TwoWay = true
- pendingResponse := remoting.NewPendingResponse(request.ID)
- user3 := map[any]any{}
- pendingResponse.Reply = &user3
- remoting.AddPendingResponse(pendingResponse)
- err = c.Request(request, 3*time.Second, pendingResponse)
- assert.NoError(t, err)
- assert.NotNil(t, user3)
- assert.Equal(t, &User{ID: "1", Name: "username"}, user3["key"])
-}
-
-func testGetUser6(t *testing.T, c *Client) {
- var (
- user *User
- err error
- )
- user = &User{}
- request := remoting.NewRequest("2.0.2")
- invocation := invocation.NewRPCInvocation("GetUser6", []any{0}, nil)
- attachment := map[string]string{InterfaceKey: "com.ikurento.user.UserProvider"}
- setAttachment(invocation, attachment)
- request.Data = invocation
- request.Event = false
- request.TwoWay = true
- pendingResponse := remoting.NewPendingResponse(request.ID)
- pendingResponse.Reply = user
- remoting.AddPendingResponse(pendingResponse)
- err = c.Request(request, 3*time.Second, pendingResponse)
- assert.NoError(t, err)
- assert.Equal(t, User{ID: "", Name: ""}, *user)
-}
-
-func testGetUser61(t *testing.T, c *Client) {
- var (
- user *User
- err error
- )
- user = &User{}
- request := remoting.NewRequest("2.0.2")
- invocation := invocation.NewRPCInvocation("GetUser6", []any{1}, nil)
- attachment := map[string]string{InterfaceKey: "com.ikurento.user.UserProvider"}
- setAttachment(invocation, attachment)
- request.Data = invocation
- request.Event = false
- request.TwoWay = true
- pendingResponse := remoting.NewPendingResponse(request.ID)
- pendingResponse.Reply = user
- remoting.AddPendingResponse(pendingResponse)
- err = c.Request(request, 3*time.Second, pendingResponse)
- assert.NoError(t, err)
- assert.Equal(t, User{ID: "1", Name: ""}, *user)
-}
-
func testClient_AsyncCall(t *testing.T, client *Client) {
user := &User{}
wg := sync.WaitGroup{}
diff --git a/remoting/getty/pool.go b/remoting/getty/pool.go
index b6ccba534..300d4a24b 100644
--- a/remoting/getty/pool.go
+++ b/remoting/getty/pool.go
@@ -105,10 +105,6 @@ func (c *gettyRPCClient) updateActive(active int64) {
atomic.StoreInt64(&c.active, active)
}
-func (c *gettyRPCClient) getActive() int64 {
- return atomic.LoadInt64(&c.active)
-}
-
func (c *gettyRPCClient) newSession(session getty.Session) error {
var (
ok bool
diff --git a/remoting/polaris/builder.go b/remoting/polaris/builder.go
index 30ab31d9e..172df22a1 100644
--- a/remoting/polaris/builder.go
+++ b/remoting/polaris/builder.go
@@ -132,29 +132,3 @@ func InitSDKContext(url *common.URL) error {
return rerr
}
-
-func mergePolarisConfiguration(easy, complexConf config.Configuration) {
-
- easySvrList := easy.GetGlobal().GetServerConnector().GetAddresses()
-
- complexSvrList := complexConf.GetGlobal().GetServerConnector().GetAddresses()
-
- result := make(map[string]bool)
-
- for i := range complexSvrList {
- result[complexSvrList[i]] = true
- }
-
- for i := range easySvrList {
- if _, exist := result[easySvrList[i]]; !exist {
- result[easySvrList[i]] = true
- }
- }
-
- finalSvrList := make([]string, 0)
- for k := range result {
- finalSvrList = append(finalSvrList, k)
- }
-
- complexConf.GetGlobal().GetServerConnector().SetAddresses(finalSvrList)
-}
diff --git a/remoting/polaris/parser/parser.go b/remoting/polaris/parser/parser.go
index c8bec14f9..e99e175cd 100644
--- a/remoting/polaris/parser/parser.go
+++ b/remoting/polaris/parser/parser.go
@@ -19,7 +19,6 @@ package parser
import (
"encoding/json"
- "regexp"
"strconv"
"strings"
)
@@ -35,10 +34,6 @@ const (
_prefixParamArr = "param["
)
-var (
- _arrayRegx, _ = regexp.Compile(`"^.+\\[[0-9]+\\]"`)
-)
-
// ParseArgumentsByExpression follow https://goessner.net/articles/JsonPath/
//
// {
diff --git a/remoting/zookeeper/curator_discovery/service_discovery.go b/remoting/zookeeper/curator_discovery/service_discovery.go
index ff1230ee3..8f8185441 100644
--- a/remoting/zookeeper/curator_discovery/service_discovery.go
+++ b/remoting/zookeeper/curator_discovery/service_discovery.go
@@ -282,11 +282,6 @@ func (sd *ServiceDiscovery) pathForInstance(name, id string) string {
return path.Join(sd.basePath, name, id)
}
-// prefixPathForInstance builds the zookeeper path prefix for instances of a service.
-func (sd *ServiceDiscovery) prefixPathForInstance(name string) string {
- return path.Join(sd.basePath, name)
-}
-
// pathForName builds the zookeeper path for a service name.
func (sd *ServiceDiscovery) pathForName(name string) string {
return path.Join(sd.basePath, name)
diff --git a/server/options.go b/server/options.go
index d043808aa..3c8413a81 100644
--- a/server/options.go
+++ b/server/options.go
@@ -58,8 +58,6 @@ type ServerOptions struct {
Metrics *global.MetricsConfig
Otel *global.OtelConfig
TLS *global.TLSConfig
-
- providerCompat *config.ProviderConfig
}
func defaultServerOptions() *ServerOptions {
diff --git a/server/server.go b/server/server.go
index 7ffbb279e..8d087e39e 100644
--- a/server/server.go
+++ b/server/server.go
@@ -35,7 +35,6 @@ import (
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/common/dubboutil"
"dubbo.apache.org/dubbo-go/v3/metadata"
- "dubbo.apache.org/dubbo-go/v3/protocol/base"
"dubbo.apache.org/dubbo-go/v3/registry/exposed_tmp"
)
@@ -44,9 +43,6 @@ var proServices = make([]*InternalService, 0, 16)
var proLock sync.Mutex
type Server struct {
- invoker base.Invoker
- info *common.ServiceInfo
-
cfg *ServerOptions
svcOptsMap sync.Map