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 8ffb7e15d fix(lint): delete unused nolint comment (#2986)
8ffb7e15d is described below
commit 8ffb7e15d50e72ecbeddb3f758a83d32bceaf33c
Author: marsevilspirit <[email protected]>
AuthorDate: Tue Aug 26 09:30:54 2025 +0800
fix(lint): delete unused nolint comment (#2986)
* fix(lint): delete unused nolint comment
* style(fmt): make fmt
---
cluster/cluster/broadcast/cluster_invoker.go | 2 +-
cluster/cluster/failback/cluster_invoker.go | 2 +-
cluster/cluster/failfast/cluster_invoker.go | 2 +-
cluster/cluster/failover/cluster_test.go | 6 ----
common/constant/env.go | 2 +-
common/extension/service_instance_customizer.go | 6 ++--
.../extension/service_instance_selector_factory.go | 2 +-
common/url.go | 9 +++---
config/method_config.go | 2 +-
config_center/apollo/listener.go | 2 +-
config_center/nacos/impl_test.go | 1 -
config_center/parser/configuration_parser.go | 4 +--
filter/accesslog/filter.go | 12 ++++----
filter/hystrix/filter.go | 8 +++---
metadata/report/nacos/report.go | 2 +-
metadata/report/zookeeper/report.go | 2 +-
protocol/dubbo/hessian2/const.go | 2 +-
protocol/dubbo/hessian2/hessian_dubbo.go | 4 +--
protocol/grpc/grpc_exporter.go | 2 +-
protocol/grpc/grpc_invoker.go | 2 +-
protocol/invocation/rpcinvocation.go | 4 +--
.../protocolwrapper/protocol_filter_wrapper.go | 2 +-
protocol/rest/config/rest_config.go | 20 ++++++-------
protocol/rest/rest_exporter.go | 2 +-
protocol/rest/rest_invoker.go | 4 +--
protocol/rest/rest_protocol.go | 8 +++---
proxy/proxy.go | 2 +-
registry/base_configuration_listener.go | 2 +-
registry/etcdv3/registry.go | 2 +-
registry/etcdv3/registry_test.go | 2 +-
registry/mock_registry.go | 33 +++++++++-------------
registry/nacos/listener.go | 2 +-
registry/protocol/protocol.go | 2 +-
registry/registry.go | 2 +-
registry/service_instance.go | 2 +-
.../subscribed_urls_synthesizer_factory.go | 4 +--
registry/zookeeper/registry.go | 10 +++----
registry/zookeeper/service_discovery.go | 14 ++++-----
remoting/etcdv3/client.go | 2 +-
remoting/etcdv3/listener.go | 4 +--
remoting/getty/listener.go | 8 +++---
remoting/listener.go | 4 +--
.../curator_discovery/service_discovery.go | 6 ++--
remoting/zookeeper/listener.go | 2 +-
44 files changed, 103 insertions(+), 114 deletions(-)
diff --git a/cluster/cluster/broadcast/cluster_invoker.go
b/cluster/cluster/broadcast/cluster_invoker.go
index 5a9621ac5..39b5e1394 100644
--- a/cluster/cluster/broadcast/cluster_invoker.go
+++ b/cluster/cluster/broadcast/cluster_invoker.go
@@ -42,7 +42,7 @@ func newBroadcastClusterInvoker(directory
directory.Directory) protocolbase.Invo
}
}
-// nolint
+// Invoke broadcasts the invocation to all invokers and aggregates errors.
func (invoker *broadcastClusterInvoker) Invoke(ctx context.Context, invocation
protocolbase.Invocation) result.Result {
invokers := invoker.Directory.List(invocation)
err := invoker.CheckInvokers(invokers, invocation)
diff --git a/cluster/cluster/failback/cluster_invoker.go
b/cluster/cluster/failback/cluster_invoker.go
index 5cc05145c..442e05121 100644
--- a/cluster/cluster/failback/cluster_invoker.go
+++ b/cluster/cluster/failback/cluster_invoker.go
@@ -117,7 +117,7 @@ func (invoker *failbackClusterInvoker) process(ctx
context.Context) {
}
}
-// nolint
+// Invoke executes with failback semantics: schedule retries on failure.
func (invoker *failbackClusterInvoker) Invoke(ctx context.Context, invocation
protocolbase.Invocation) result.Result {
invokers := invoker.Directory.List(invocation)
if err := invoker.CheckInvokers(invokers, invocation); err != nil {
diff --git a/cluster/cluster/failfast/cluster_invoker.go
b/cluster/cluster/failfast/cluster_invoker.go
index 094638b75..4d04695ec 100644
--- a/cluster/cluster/failfast/cluster_invoker.go
+++ b/cluster/cluster/failfast/cluster_invoker.go
@@ -38,7 +38,7 @@ func newFailfastClusterInvoker(directory directory.Directory)
protocolbase.Invok
}
}
-// nolint
+// Invoke performs a single attempt invocation and fails fast on error.
func (invoker *failfastClusterInvoker) Invoke(ctx context.Context, invocation
protocolbase.Invocation) result.Result {
invokers := invoker.Directory.List(invocation)
err := invoker.CheckInvokers(invokers, invocation)
diff --git a/cluster/cluster/failover/cluster_test.go
b/cluster/cluster/failover/cluster_test.go
index f039b73c7..6e68746f3 100644
--- a/cluster/cluster/failover/cluster_test.go
+++ b/cluster/cluster/failover/cluster_test.go
@@ -40,7 +40,6 @@ import (
"dubbo.apache.org/dubbo-go/v3/protocol/result"
)
-// nolint
func normalInvoke(successCount int, urlParam url.Values, invocations
...*invocation.RPCInvocation) result.Result {
extension.SetLoadbalance("random", random.NewRandomLoadBalance)
failoverCluster := newFailoverCluster()
@@ -59,7 +58,6 @@ func normalInvoke(successCount int, urlParam url.Values,
invocations ...*invocat
return clusterInvoker.Invoke(context.Background(),
&invocation.RPCInvocation{})
}
-// nolint
func TestFailoverInvokeSuccess(t *testing.T) {
urlParams := url.Values{}
result := normalInvoke(3, urlParams)
@@ -67,7 +65,6 @@ func TestFailoverInvokeSuccess(t *testing.T) {
clusterpkg.Count = 0
}
-// nolint
func TestFailoverInvokeFail(t *testing.T) {
urlParams := url.Values{}
result := normalInvoke(4, urlParams)
@@ -75,7 +72,6 @@ func TestFailoverInvokeFail(t *testing.T) {
clusterpkg.Count = 0
}
-// nolint
func TestFailoverInvoke1(t *testing.T) {
urlParams := url.Values{}
urlParams.Set(constant.RetriesKey, "3")
@@ -84,7 +80,6 @@ func TestFailoverInvoke1(t *testing.T) {
clusterpkg.Count = 0
}
-// nolint
func TestFailoverInvoke2(t *testing.T) {
urlParams := url.Values{}
urlParams.Set(constant.RetriesKey, "2")
@@ -96,7 +91,6 @@ func TestFailoverInvoke2(t *testing.T) {
clusterpkg.Count = 0
}
-// nolint
func TestFailoverDestroy(t *testing.T) {
extension.SetLoadbalance("random", random.NewRandomLoadBalance)
failoverCluster := newFailoverCluster()
diff --git a/common/constant/env.go b/common/constant/env.go
index 55283efc7..4413c201f 100644
--- a/common/constant/env.go
+++ b/common/constant/env.go
@@ -17,7 +17,7 @@
package constant
-// nolint
+// Environment-related default values and keys.
const (
DefaultDubboApp = "dubbo.io"
ConfigFileEnvKey = "DUBBO_GO_CONFIG_PATH" // key of environment
variable dubbogo configure file path
diff --git a/common/extension/service_instance_customizer.go
b/common/extension/service_instance_customizer.go
index 1ef76db74..1129d578f 100644
--- a/common/extension/service_instance_customizer.go
+++ b/common/extension/service_instance_customizer.go
@@ -42,13 +42,13 @@ func GetCustomizers() []registry.ServiceInstanceCustomizer {
type customizerSlice []registry.ServiceInstanceCustomizer
-// nolint
+// Len returns the number of customizers.
func (c customizerSlice) Len() int {
return len(c)
}
-// nolint
+// Swap swaps the customizers at the provided indices.
func (c customizerSlice) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
-// nolint
+// Less orders customizers by priority (lower value means higher priority).
func (c customizerSlice) Less(i, j int) bool { return c[i].GetPriority() <
c[j].GetPriority() }
diff --git a/common/extension/service_instance_selector_factory.go
b/common/extension/service_instance_selector_factory.go
index 36e6f45bc..e7c636501 100644
--- a/common/extension/service_instance_selector_factory.go
+++ b/common/extension/service_instance_selector_factory.go
@@ -27,7 +27,7 @@ import (
var serviceInstanceSelectorMappings = make(map[string]func()
instance.ServiceInstanceSelector, 2)
-// nolint
+// SetServiceInstanceSelector registers a factory for ServiceInstanceSelector.
func SetServiceInstanceSelector(name string, f func()
instance.ServiceInstanceSelector) {
serviceInstanceSelectorMappings[name] = f
}
diff --git a/common/url.go b/common/url.go
index 9e194ecb2..09474729c 100644
--- a/common/url.go
+++ b/common/url.go
@@ -65,7 +65,8 @@ func init() {
compareURLEqualFunc = defaultCompareURLEqual
}
-// nolint
+// RoleType defines the role of the node in Dubbo service topology.
+// The values are indexes for arrays like DubboNodes and DubboRole.
type RoleType int
func (t RoleType) String() string {
@@ -965,17 +966,17 @@ func IsEquals(left *URL, right *URL, excludes ...string)
bool {
// Instances will be order by URL.String()
type URLSlice []*URL
-// nolint
+// Len returns the number of URLs in the slice.
func (s URLSlice) Len() int {
return len(s)
}
-// nolint
+// Less reports whether the URL at index i should sort before the URL at index
j.
func (s URLSlice) Less(i, j int) bool {
return s[i].String() < s[j].String()
}
-// nolint
+// Swap swaps the URLs at indexes i and j.
func (s URLSlice) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
diff --git a/config/method_config.go b/config/method_config.go
index 093df5d40..3a52260ea 100644
--- a/config/method_config.go
+++ b/config/method_config.go
@@ -48,7 +48,7 @@ type MethodConfig struct {
RequestTimeout string `yaml:"timeout"
json:"timeout,omitempty" property:"timeout"`
}
-// nolint
+// Prefix builds the configuration key prefix for this method.
func (m *MethodConfig) Prefix() string {
if len(m.InterfaceId) != 0 {
return constant.Dubbo + "." + m.InterfaceName + "." +
m.InterfaceId + "." + m.Name + "."
diff --git a/config_center/apollo/listener.go b/config_center/apollo/listener.go
index 0d186d6f8..37cea9801 100644
--- a/config_center/apollo/listener.go
+++ b/config_center/apollo/listener.go
@@ -34,7 +34,7 @@ type apolloListener struct {
listeners map[config_center.ConfigurationListener]struct{}
}
-// nolint
+// newApolloListener constructs an apolloListener with empty listener set.
func newApolloListener() *apolloListener {
return &apolloListener{
listeners:
make(map[config_center.ConfigurationListener]struct{}),
diff --git a/config_center/nacos/impl_test.go b/config_center/nacos/impl_test.go
index 4ea7f38f3..b3ae1d406 100644
--- a/config_center/nacos/impl_test.go
+++ b/config_center/nacos/impl_test.go
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-// nolint
package nacos
import (
diff --git a/config_center/parser/configuration_parser.go
b/config_center/parser/configuration_parser.go
index 81c98b73d..7c69ef5cd 100644
--- a/config_center/parser/configuration_parser.go
+++ b/config_center/parser/configuration_parser.go
@@ -192,7 +192,7 @@ func serviceItemToUrls(item ConfigItem, config
ConfiguratorConfig) ([]*common.UR
return urls, nil
}
-// nolint
+// appItemToUrls builds override URLs for application-scope items.
func appItemToUrls(item ConfigItem, config ConfiguratorConfig) ([]*common.URL,
error) {
addresses := item.Addresses
if len(addresses) == 0 {
@@ -258,7 +258,7 @@ func getServiceString(service string) (string, error) {
return serviceStr, nil
}
-// nolint
+// getParamString serializes parameters of a ConfigItem to query string.
func getParamString(item ConfigItem) (string, error) {
var retStr string
retStr = retStr + "category="
diff --git a/filter/accesslog/filter.go b/filter/accesslog/filter.go
index bea72ec8e..398a91ac1 100644
--- a/filter/accesslog/filter.go
+++ b/filter/accesslog/filter.go
@@ -41,20 +41,20 @@ import (
const (
// used in URL.
- // nolint
+ // FileDateFormat is the date format used for file rotation.
FileDateFormat = "2006-01-02"
- // nolint
+ // MessageDateLayout is the datetime layout used in log message.
MessageDateLayout = "2006-01-02 15:04:05"
- // nolint
+ // LogMaxBuffer is the max buffered log items.
LogMaxBuffer = 5000
- // nolint
+ // LogFileMode is the file permission for access log files.
LogFileMode = 0o600
// those fields are the data collected by this filter
- // nolint
+ // Types represents the list of argument types in log.
Types = "types"
- // nolint
+ // Arguments represents the arguments string in log.
Arguments = "arguments"
)
diff --git a/filter/hystrix/filter.go b/filter/hystrix/filter.go
index 3d2b859be..79cc70025 100644
--- a/filter/hystrix/filter.go
+++ b/filter/hystrix/filter.go
@@ -46,7 +46,7 @@ import (
)
const (
- // nolint
+ // HYSTRIX is the key used in filter configuration.
HYSTRIX = "hystrix"
)
@@ -303,7 +303,7 @@ func initConfigProvider() error {
// return initHystrixConfig()
//}
-// nolint
+// CommandConfigWithError describes hystrix command configs with error
whitelist.
type CommandConfigWithError struct {
Timeout int `yaml:"timeout"`
MaxConcurrentRequests int `yaml:"max_concurrent_requests"`
@@ -321,14 +321,14 @@ type CommandConfigWithError struct {
//- ErrorPercentThreshold: it causes circuits to open once the rolling measure
of errors exceeds this percent of requests
//See hystrix doc
-// nolint
+// FilterConfig holds hystrix configs at default/service/method levels.
type FilterConfig struct {
Configs map[string]*CommandConfigWithError
Default string
Services map[string]ServiceHystrixConfig
}
-// nolint
+// ServiceHystrixConfig binds service-level and method-level hystrix configs.
type ServiceHystrixConfig struct {
ServiceConfig string `yaml:"service_config"`
Methods map[string]string
diff --git a/metadata/report/nacos/report.go b/metadata/report/nacos/report.go
index 66545b9c5..d93beb48a 100644
--- a/metadata/report/nacos/report.go
+++ b/metadata/report/nacos/report.go
@@ -216,7 +216,7 @@ func (n *nacosMetadataReport)
RemoveServiceAppMappingListener(key string, group
type nacosMetadataReportFactory struct{}
-// nolint
+// CreateMetadataReport creates the nacos-based metadata report implementation.
func (n *nacosMetadataReportFactory) CreateMetadataReport(url *common.URL)
report.MetadataReport {
url.SetParam(constant.NacosNamespaceID,
url.GetParam(constant.MetadataReportNamespaceKey, ""))
url.SetParam(constant.TimeoutKey, url.GetParam(constant.TimeoutKey,
constant.DefaultRegTimeout))
diff --git a/metadata/report/zookeeper/report.go
b/metadata/report/zookeeper/report.go
index 79a43ed6a..e5e6d3d13 100644
--- a/metadata/report/zookeeper/report.go
+++ b/metadata/report/zookeeper/report.go
@@ -136,7 +136,7 @@ func (m *zookeeperMetadataReport)
RemoveServiceAppMappingListener(key string, gr
type zookeeperMetadataReportFactory struct{}
-// nolint
+// CreateMetadataReport creates the zookeeper-based metadata report
implementation.
func (mf *zookeeperMetadataReportFactory) CreateMetadataReport(url
*common.URL) report.MetadataReport {
client, err := gxzookeeper.NewZookeeperClient(
"zookeeperMetadataReport",
diff --git a/protocol/dubbo/hessian2/const.go b/protocol/dubbo/hessian2/const.go
index 49ba16e6e..3e229a0f0 100644
--- a/protocol/dubbo/hessian2/const.go
+++ b/protocol/dubbo/hessian2/const.go
@@ -228,7 +228,7 @@ var (
ErrIllegalPackage = perrors.New("illegal package!")
)
-// nolint
+// DescRegex is the precompiled regexp for method descriptor patterns.
var DescRegex, _ = regexp.Compile(DESC_REGEX)
var NilValue = reflect.Zero(reflect.TypeOf((*any)(nil)).Elem())
diff --git a/protocol/dubbo/hessian2/hessian_dubbo.go
b/protocol/dubbo/hessian2/hessian_dubbo.go
index ed38db950..23366f1b0 100644
--- a/protocol/dubbo/hessian2/hessian_dubbo.go
+++ b/protocol/dubbo/hessian2/hessian_dubbo.go
@@ -24,7 +24,7 @@ import (
)
import (
- "github.com/apache/dubbo-go-hessian2"
+ hessian "github.com/apache/dubbo-go-hessian2"
perrors "github.com/pkg/errors"
)
@@ -40,7 +40,7 @@ const (
PackageType_BitSize = 0x2f
)
-// PackageType nolint
+// PackageType represents the bitmask for dubbo package types.
type PackageType int
// DubboHeader dubbo header
diff --git a/protocol/grpc/grpc_exporter.go b/protocol/grpc/grpc_exporter.go
index 7e2a84230..febd88b88 100644
--- a/protocol/grpc/grpc_exporter.go
+++ b/protocol/grpc/grpc_exporter.go
@@ -31,7 +31,7 @@ import (
"dubbo.apache.org/dubbo-go/v3/protocol/base"
)
-// nolint
+// GrpcExporter is the exporter implementation for gRPC protocol.
type GrpcExporter struct {
*base.BaseExporter
}
diff --git a/protocol/grpc/grpc_invoker.go b/protocol/grpc/grpc_invoker.go
index 4039ea1c7..2b4ea43c4 100644
--- a/protocol/grpc/grpc_invoker.go
+++ b/protocol/grpc/grpc_invoker.go
@@ -41,7 +41,7 @@ import (
var errNoReply = errors.New("request need @response")
-// nolint
+// GrpcInvoker is a gRPC invoker wrapping a generated client and guarding its
lifecycle.
type GrpcInvoker struct {
base.BaseInvoker
quitOnce sync.Once
diff --git a/protocol/invocation/rpcinvocation.go
b/protocol/invocation/rpcinvocation.go
index 84fb4b652..8219c8c22 100644
--- a/protocol/invocation/rpcinvocation.go
+++ b/protocol/invocation/rpcinvocation.go
@@ -35,7 +35,7 @@ import (
var _ base.Invocation = (*RPCInvocation)(nil)
// todo: is it necessary to separate fields of consumer(provider) from
RPCInvocation
-// nolint
+// RPCInvocation carries method, parameters, attachments and invocation
metadata.
type RPCInvocation struct {
methodName string
// Parameter Type Names. It is used to specify the parameterType
@@ -157,7 +157,7 @@ func (r *RPCInvocation) Invoker() base.Invoker {
return r.invoker
}
-// nolint
+// SetInvoker sets the invoker in current context (thread-safe).
func (r *RPCInvocation) SetInvoker(invoker base.Invoker) {
r.lock.Lock()
defer r.lock.Unlock()
diff --git a/protocol/protocolwrapper/protocol_filter_wrapper.go
b/protocol/protocolwrapper/protocol_filter_wrapper.go
index 1539b6654..7f398606e 100644
--- a/protocol/protocolwrapper/protocol_filter_wrapper.go
+++ b/protocol/protocolwrapper/protocol_filter_wrapper.go
@@ -102,7 +102,7 @@ func BuildInvokerChain(invoker base.Invoker, key string)
base.Invoker {
return next
}
-// nolint
+// GetProtocol returns a Protocol that applies filter chains around another
protocol.
func GetProtocol() base.Protocol {
return &ProtocolFilterWrapper{}
}
diff --git a/protocol/rest/config/rest_config.go
b/protocol/rest/config/rest_config.go
index 9450b7276..4752abb3a 100644
--- a/protocol/rest/config/rest_config.go
+++ b/protocol/rest/config/rest_config.go
@@ -26,7 +26,7 @@ var (
restProviderServiceConfigMap map[string]*RestServiceConfig
)
-// nolint
+// RestConsumerConfig holds consumer-side REST settings and references.
type RestConsumerConfig struct {
Client string `default:"resty"
yaml:"rest_client" json:"rest_client,omitempty" property:"rest_client"`
Produces string
`default:"application/json" yaml:"rest_produces"
json:"rest_produces,omitempty" property:"rest_produces"`
@@ -46,7 +46,7 @@ func (c *RestConsumerConfig) UnmarshalYAML(unmarshal
func(any) error) error {
return nil
}
-// nolint
+// RestProviderConfig holds provider-side REST settings and services.
type RestProviderConfig struct {
Server string
`default:"go-restful" yaml:"rest_server" json:"rest_server,omitempty"
property:"rest_server"`
Produces string `default:"*/*"
yaml:"rest_produces" json:"rest_produces,omitempty" property:"rest_produces"`
@@ -66,7 +66,7 @@ func (c *RestProviderConfig) UnmarshalYAML(unmarshal
func(any) error) error {
return nil
}
-// nolint
+// RestServiceConfig describes a REST service and its methods.
type RestServiceConfig struct {
InterfaceName string `required:"true"
yaml:"interface" json:"interface,omitempty" property:"interface"`
URL string `yaml:"url"
json:"url,omitempty" property:"url"`
@@ -92,7 +92,7 @@ func (c *RestServiceConfig) UnmarshalYAML(unmarshal func(any)
error) error {
return nil
}
-// nolint
+// RestMethodConfig describes a REST method mapping and parameters.
type RestMethodConfig struct {
InterfaceName string
MethodName string `required:"true" yaml:"name"
json:"name,omitempty" property:"name"`
@@ -122,32 +122,32 @@ func (c *RestMethodConfig) UnmarshalYAML(unmarshal
func(any) error) error {
return nil
}
-// nolint
+// GetRestConsumerServiceConfig returns consumer service config by id.
func GetRestConsumerServiceConfig(id string) *RestServiceConfig {
return restConsumerServiceConfigMap[id]
}
-// nolint
+// GetRestProviderServiceConfig returns provider service config by id.
func GetRestProviderServiceConfig(id string) *RestServiceConfig {
return restProviderServiceConfigMap[id]
}
-// nolint
+// SetRestConsumerServiceConfigMap sets consumer service configs map.
func SetRestConsumerServiceConfigMap(configMap map[string]*RestServiceConfig) {
restConsumerServiceConfigMap = configMap
}
-// nolint
+// SetRestProviderServiceConfigMap sets provider service configs map.
func SetRestProviderServiceConfigMap(configMap map[string]*RestServiceConfig) {
restProviderServiceConfigMap = configMap
}
-// nolint
+// GetRestConsumerServiceConfigMap returns the consumer service configs map.
func GetRestConsumerServiceConfigMap() map[string]*RestServiceConfig {
return restConsumerServiceConfigMap
}
-// nolint
+// GetRestProviderServiceConfigMap returns the provider service configs map.
func GetRestProviderServiceConfigMap() map[string]*RestServiceConfig {
return restProviderServiceConfigMap
}
diff --git a/protocol/rest/rest_exporter.go b/protocol/rest/rest_exporter.go
index 65adf1225..222346c02 100644
--- a/protocol/rest/rest_exporter.go
+++ b/protocol/rest/rest_exporter.go
@@ -31,7 +31,7 @@ import (
"dubbo.apache.org/dubbo-go/v3/protocol/base"
)
-// nolint
+// RestExporter is the exporter implementation for REST protocol.
type RestExporter struct {
base.BaseExporter
}
diff --git a/protocol/rest/rest_invoker.go b/protocol/rest/rest_invoker.go
index 87a39a010..d0fae617f 100644
--- a/protocol/rest/rest_invoker.go
+++ b/protocol/rest/rest_invoker.go
@@ -36,7 +36,7 @@ import (
"dubbo.apache.org/dubbo-go/v3/protocol/result"
)
-// nolint
+// RestInvoker invokes REST services using a RestClient and method mappings.
type RestInvoker struct {
base.BaseInvoker
client client.RestClient
@@ -111,7 +111,7 @@ func restStringMapTransform(paramsMap map[int]string, args
[]any) (map[string]st
return resMap, nil
}
-// nolint
+// getRestHttpHeader builds the HTTP headers for a REST call based on method
config and args.
func getRestHttpHeader(methodConfig *config.RestMethodConfig, args []any)
(http.Header, error) {
header := http.Header{}
headersMap := methodConfig.HeadersMap
diff --git a/protocol/rest/rest_protocol.go b/protocol/rest/rest_protocol.go
index b9b43cce2..8b26a3bbd 100644
--- a/protocol/rest/rest_protocol.go
+++ b/protocol/rest/rest_protocol.go
@@ -43,12 +43,12 @@ var restProtocol *RestProtocol
const REST = "rest"
-// nolint
+// init registers the REST protocol in extension.
func init() {
extension.SetProtocol(REST, GetRestProtocol)
}
-// nolint
+// RestProtocol implements base.Protocol for REST.
type RestProtocol struct {
base.BaseProtocol
serverLock sync.Mutex
@@ -111,7 +111,7 @@ func (rp *RestProtocol) Refer(url *common.URL) base.Invoker
{
return invoker
}
-// nolint
+// getServer returns or creates a RestServer for the given URL.
func (rp *RestProtocol) getServer(url *common.URL, serverType string)
server.RestServer {
restServer, ok := rp.serverMap[url.Location]
if ok {
@@ -133,7 +133,7 @@ func (rp *RestProtocol) getServer(url *common.URL,
serverType string) server.Res
return restServer
}
-// nolint
+// getClient returns or creates a RestClient for the given options.
func (rp *RestProtocol) getClient(restOptions client.RestOptions, clientType
string) client.RestClient {
restClient, ok := rp.clientMap[restOptions]
if ok {
diff --git a/proxy/proxy.go b/proxy/proxy.go
index 4c8afadbd..eada6a1bc 100644
--- a/proxy/proxy.go
+++ b/proxy/proxy.go
@@ -40,7 +40,7 @@ import (
"dubbo.apache.org/dubbo-go/v3/protocol/invocation"
)
-// nolint
+// Proxy is the reflective RPC proxy for Dubbo2 style services.
type Proxy struct {
rpc common.RPCService
invoke base.Invoker
diff --git a/registry/base_configuration_listener.go
b/registry/base_configuration_listener.go
index 9c13c6ff4..3e9302764 100644
--- a/registry/base_configuration_listener.go
+++ b/registry/base_configuration_listener.go
@@ -31,7 +31,7 @@ import (
"dubbo.apache.org/dubbo-go/v3/remoting"
)
-// nolint
+// BaseConfigurationListener provides shared logic for processing
configuration center updates.
type BaseConfigurationListener struct {
configurators []config_center.Configurator
dynamicConfiguration config_center.DynamicConfiguration
diff --git a/registry/etcdv3/registry.go b/registry/etcdv3/registry.go
index 42f7e4bf5..b0155dc6b 100644
--- a/registry/etcdv3/registry.go
+++ b/registry/etcdv3/registry.go
@@ -109,7 +109,7 @@ func (r *etcdV3Registry) DoRegister(root string, node
string) error {
return r.client.RegisterTemp(path.Join(root, node), "")
}
-// nolint
+// DoUnregister is not supported in etcdV3Registry.
func (r *etcdV3Registry) DoUnregister(root string, node string) error {
return perrors.New("DoUnregister is not support in etcdV3Registry")
}
diff --git a/registry/etcdv3/registry_test.go b/registry/etcdv3/registry_test.go
index 5aefdd1da..02c718f32 100644
--- a/registry/etcdv3/registry_test.go
+++ b/registry/etcdv3/registry_test.go
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-// nolint
+// Package etcdv3 contains tests for etcdv3 registry components.
package etcdv3
/*
diff --git a/registry/mock_registry.go b/registry/mock_registry.go
index 28c2805ad..5c6b1ef1c 100644
--- a/registry/mock_registry.go
+++ b/registry/mock_registry.go
@@ -55,15 +55,14 @@ func (*MockRegistry) Register(url *common.URL) error {
return nil
}
-// nolint
+// UnRegister unregisters the given URL from mock registry.
func (r *MockRegistry) UnRegister(conf *common.URL) error {
return nil
}
-// nolint
+// Destroy marks the mock registry as destroyed.
func (r *MockRegistry) Destroy() {
- if r.destroyed.CompareAndSwap(false, true) {
- }
+ r.destroyed.Store(true)
}
// IsAvailable is use for determine a mock registry available
@@ -71,7 +70,7 @@ func (r *MockRegistry) IsAvailable() bool {
return !r.destroyed.Load()
}
-// nolint
+// GetURL returns the registry URL.
func (r *MockRegistry) GetURL() *common.URL {
return nil
}
@@ -80,7 +79,7 @@ func (r *MockRegistry) subscribe(*common.URL) (Listener,
error) {
return r.listener, nil
}
-// nolint
+// Subscribe subscribes to service events and notifies the listener.
func (r *MockRegistry) Subscribe(url *common.URL, notifyListener
NotifyListener) error {
go func() {
for {
@@ -106,20 +105,16 @@ func (r *MockRegistry) Subscribe(url *common.URL,
notifyListener NotifyListener)
go func() {
for {
t, _ := r.checkLoopSubscribe(url)
+ if t == -1 {
+ return
+ }
if t == 0 {
continue
- } else if t == -1 {
- return
}
-
- for {
- select {
- case e := <-r.allAddress:
- notifyListener.NotifyAll(e, func() {
- fmt.Print("notify all ok")
- })
- break
- }
+ for e := range r.allAddress {
+ notifyListener.NotifyAll(e, func() {
+ fmt.Print("notify all ok")
+ })
}
}
}()
@@ -149,12 +144,12 @@ func (l *listener) Next() (*ServiceEvent, error) {
func (*listener) Close() {
}
-// nolint
+// MockEvent sends a single event to subscribers.
func (r *MockRegistry) MockEvent(event *ServiceEvent) {
r.listener.listenChan <- event
}
-// nolint
+// MockEvents sends a batch of events to subscribers.
func (r *MockRegistry) MockEvents(events []*ServiceEvent) {
r.allAddress <- events
}
diff --git a/registry/nacos/listener.go b/registry/nacos/listener.go
index 46d994160..708521eb6 100644
--- a/registry/nacos/listener.go
+++ b/registry/nacos/listener.go
@@ -213,7 +213,7 @@ func (nl *nacosListener) Next() (*registry.ServiceEvent,
error) {
}
}
-// nolint
+// Close stops the subscription and releases resources.
func (nl *nacosListener) Close() {
nl.once.Do(func() {
_ = nl.stopListen()
diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go
index 42c15e665..991ac8150 100644
--- a/registry/protocol/protocol.go
+++ b/registry/protocol/protocol.go
@@ -128,7 +128,7 @@ func (proto *registryProtocol) initConfigurationListeners()
{
proto.providerConfigurationListener =
newProviderConfigurationListener(proto.overrideListeners)
}
-// nolint
+// GetRegistries returns all underlying registry instances.
func (proto *registryProtocol) GetRegistries() []registry.Registry {
var rs []registry.Registry
proto.registries.Range(func(_, v any) bool {
diff --git a/registry/registry.go b/registry/registry.go
index b261caaf2..663436d4b 100644
--- a/registry/registry.go
+++ b/registry/registry.go
@@ -67,7 +67,7 @@ type Registry interface {
LoadSubscribeInstances(*common.URL, NotifyListener) error
}
-// nolint
+// NotifyListener handles service change notifications from Registry
implementations.
type NotifyListener interface {
// Notify supports notifications on the service interface and the
dimension of the data type. When a list of
// events are passed in, it's considered as a complete list, on the
other side, if one single event is
diff --git a/registry/service_instance.go b/registry/service_instance.go
index 4a24906ff..01569d350 100644
--- a/registry/service_instance.go
+++ b/registry/service_instance.go
@@ -81,7 +81,7 @@ type ServiceInstance interface {
GetWeight() int64
}
-// nolint
+// Endpoint describes an exposed port and protocol of a service instance.
type Endpoint struct {
Port int `json:"port,omitempty"`
Protocol string `json:"protocol,omitempty"`
diff --git
a/registry/servicediscovery/synthesizer/subscribed_urls_synthesizer_factory.go
b/registry/servicediscovery/synthesizer/subscribed_urls_synthesizer_factory.go
index c9b1449be..716291456 100644
---
a/registry/servicediscovery/synthesizer/subscribed_urls_synthesizer_factory.go
+++
b/registry/servicediscovery/synthesizer/subscribed_urls_synthesizer_factory.go
@@ -26,14 +26,14 @@ var (
synthesizerMutex sync.RWMutex
)
-// nolint
+// AddSynthesizer registers a SubscribedURLsSynthesizer into the factory list.
func AddSynthesizer(synthesizer SubscribedURLsSynthesizer) {
synthesizerMutex.Lock()
defer synthesizerMutex.Unlock()
synthesizers = append(synthesizers, synthesizer)
}
-// nolint
+// GetAllSynthesizer returns all registered SubscribedURLsSynthesizer.
func GetAllSynthesizer() []SubscribedURLsSynthesizer {
synthesizerMutex.RLock()
defer synthesizerMutex.RUnlock()
diff --git a/registry/zookeeper/registry.go b/registry/zookeeper/registry.go
index 594d64bc4..6245f6ac5 100644
--- a/registry/zookeeper/registry.go
+++ b/registry/zookeeper/registry.go
@@ -82,12 +82,12 @@ func newZkRegistry(url *common.URL) (registry.Registry,
error) {
return r, nil
}
-// nolint
+// Options defines optional parameters to construct a zkRegistry (used in
tests/mocks).
type Options struct {
client *gxzookeeper.ZookeeperClient
}
-// nolint
+// 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) {
@@ -186,17 +186,17 @@ func (r *zkRegistry) CloseAndNilClient() {
r.client = nil
}
-// nolint
+// ZkClient returns the underlying zookeeper client.
func (r *zkRegistry) ZkClient() *gxzookeeper.ZookeeperClient {
return r.client
}
-// nolint
+// SetZkClient sets the underlying zookeeper client.
func (r *zkRegistry) SetZkClient(client *gxzookeeper.ZookeeperClient) {
r.client = client
}
-// nolint
+// ZkClientLock exposes the lock guarding client changes.
func (r *zkRegistry) ZkClientLock() *sync.Mutex {
return &r.cltLock
}
diff --git a/registry/zookeeper/service_discovery.go
b/registry/zookeeper/service_discovery.go
index be64dffba..868ad6aa0 100644
--- a/registry/zookeeper/service_discovery.go
+++ b/registry/zookeeper/service_discovery.go
@@ -83,27 +83,27 @@ func newZookeeperServiceDiscovery(url *common.URL)
(registry.ServiceDiscovery, e
return zksd, nil
}
-// nolint
+// ZkClient returns the underlying zookeeper client.
func (zksd *zookeeperServiceDiscovery) ZkClient() *gxzookeeper.ZookeeperClient
{
return zksd.client
}
-// nolint
+// SetZkClient sets the underlying zookeeper client.
func (zksd *zookeeperServiceDiscovery) SetZkClient(client
*gxzookeeper.ZookeeperClient) {
zksd.client = client
}
-// nolint
+// ZkClientLock exposes the lock guarding client changes.
func (zksd *zookeeperServiceDiscovery) ZkClientLock() *sync.Mutex {
return &zksd.cltLock
}
-// nolint
+// WaitGroup exposes the wait group used to track internal goroutines.
func (zksd *zookeeperServiceDiscovery) WaitGroup() *sync.WaitGroup {
return &zksd.wg
}
-// nolint
+// Done returns the done channel used to signal shutdown.
func (zksd *zookeeperServiceDiscovery) Done() chan struct{} {
return zksd.done
}
@@ -120,12 +120,12 @@ func (zksd *zookeeperServiceDiscovery) RestartCallBack()
bool {
return true
}
-// nolint
+// GetURL returns the service discovery URL.
func (zksd *zookeeperServiceDiscovery) GetURL() *common.URL {
return zksd.url
}
-// nolint
+// String returns a concise description of the service discovery.
func (zksd *zookeeperServiceDiscovery) String() string {
return fmt.Sprintf("zookeeper-service-discovery[%s]", zksd.url)
}
diff --git a/remoting/etcdv3/client.go b/remoting/etcdv3/client.go
index 86ff77f05..3a73329cd 100644
--- a/remoting/etcdv3/client.go
+++ b/remoting/etcdv3/client.go
@@ -59,7 +59,7 @@ func ValidateClient(container clientFacade, opts
...gxetcd.Option) error {
return nil
}
-// nolint
+// NewServiceDiscoveryClient creates a new etcd client for service discovery
with sensible defaults.
func NewServiceDiscoveryClient(opts ...gxetcd.Option) *gxetcd.Client {
options := &gxetcd.Options{
Heartbeat: 1, // default heartbeat
diff --git a/remoting/etcdv3/listener.go b/remoting/etcdv3/listener.go
index 86b5643a8..7ab51b838 100644
--- a/remoting/etcdv3/listener.go
+++ b/remoting/etcdv3/listener.go
@@ -37,7 +37,7 @@ import (
"dubbo.apache.org/dubbo-go/v3/remoting"
)
-// nolint
+// EventListener watches etcd keys and forwards events to DataListener.
type EventListener struct {
client *gxetcd.Client
keyMapLock sync.RWMutex
@@ -226,7 +226,7 @@ func (l *EventListener) ListenServiceEvent(key string,
listener remoting.DataLis
}(key)
}
-// nolint
+// Close waits for all spawned goroutines to finish.
func (l *EventListener) Close() {
l.wg.Wait()
}
diff --git a/remoting/getty/listener.go b/remoting/getty/listener.go
index 913999939..6d5e32d17 100644
--- a/remoting/getty/listener.go
+++ b/remoting/getty/listener.go
@@ -62,13 +62,13 @@ func (s *rpcSession) GetReqNum() int32 {
return atomic.LoadInt32(&s.reqNum)
}
-// nolint
+// RpcClientHandler handles client-side getty session lifecycle and messages.
type RpcClientHandler struct {
conn *gettyRPCClient
timeoutTimes int
}
-// nolint
+// NewRpcClientHandler constructs a RpcClientHandler.
func NewRpcClientHandler(client *gettyRPCClient) *RpcClientHandler {
return &RpcClientHandler{conn: client}
}
@@ -167,7 +167,7 @@ func (h *RpcClientHandler) OnCron(session getty.Session) {
}
}
-// nolint
+// RpcServerHandler handles server-side getty sessions and request processing.
type RpcServerHandler struct {
maxSessionNum int
sessionTimeout time.Duration
@@ -177,7 +177,7 @@ type RpcServerHandler struct {
timeoutTimes int
}
-// nolint
+// NewRpcServerHandler constructs a RpcServerHandler.
func NewRpcServerHandler(maxSessionNum int, sessionTimeout time.Duration,
serverP *Server) *RpcServerHandler {
return &RpcServerHandler{
maxSessionNum: maxSessionNum,
diff --git a/remoting/listener.go b/remoting/listener.go
index f998be5f2..f0a5e3a3a 100644
--- a/remoting/listener.go
+++ b/remoting/listener.go
@@ -43,7 +43,7 @@ var serviceEventTypeStrings = [...]string{
"update",
}
-// nolint
+// String returns the textual representation of EventType.
func (t EventType) String() string {
return serviceEventTypeStrings[t]
}
@@ -55,7 +55,7 @@ type Event struct {
Content string
}
-// nolint
+// String returns a concise string describing the Event.
func (e Event) String() string {
return fmt.Sprintf("Event{Action{%s}, Content{%s}}", e.Action,
e.Content)
}
diff --git a/remoting/zookeeper/curator_discovery/service_discovery.go
b/remoting/zookeeper/curator_discovery/service_discovery.go
index dae8db1a2..ff1230ee3 100644
--- a/remoting/zookeeper/curator_discovery/service_discovery.go
+++ b/remoting/zookeeper/curator_discovery/service_discovery.go
@@ -277,17 +277,17 @@ func (sd *ServiceDiscovery) getNameAndID(path string)
(string, string, error) {
return name, id, nil
}
-// nolint
+// pathForInstance builds the zookeeper path for a specific instance.
func (sd *ServiceDiscovery) pathForInstance(name, id string) string {
return path.Join(sd.basePath, name, id)
}
-// nolint
+// prefixPathForInstance builds the zookeeper path prefix for instances of a
service.
func (sd *ServiceDiscovery) prefixPathForInstance(name string) string {
return path.Join(sd.basePath, name)
}
-// nolint
+// 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/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go
index c53e074c6..f9598b734 100644
--- a/remoting/zookeeper/listener.go
+++ b/remoting/zookeeper/listener.go
@@ -130,7 +130,7 @@ func (l *ZkEventListener) ListenConfigurationEvent(zkPath
string, listener remot
}(zkPath, listener)
}
-// nolint
+// listenServiceNodeEvent watches a single zk node and reports changes via
listener.
func (l *ZkEventListener) listenServiceNodeEvent(zkPath string, listener
...remoting.DataListener) bool {
l.pathMapLock.Lock()
a, ok := l.pathMap[zkPath]