From a70ca54eebee62d2b4025330f2b7a6bb495dac2e Mon Sep 17 00:00:00 2001 From: watermelo <80680489@qq.com> Date: Tue, 2 Jun 2020 12:49:39 +0800 Subject: [PATCH 1/2] Add: add comments for config directory --- config/application_config.go | 18 ++++-------------- config/base_config.go | 4 ++-- config/config_center_config.go | 12 +++++++++--- config/consumer_config.go | 10 +++++----- config/generic_service.go | 6 +++--- config/graceful_shutdown.go | 14 +++++--------- config/graceful_shutdown_config.go | 8 ++++---- config/graceful_shutdown_signal_darwin.go | 4 ++-- config/graceful_shutdown_signal_linux.go | 4 ++-- config/graceful_shutdown_signal_windows.go | 4 ++-- config/instance/metedata_report.go | 2 +- config/interfaces/config_reader.go | 2 +- config/metadata_report_config.go | 8 ++++---- config/method_config.go | 4 ++-- config/mock_rpcservice.go | 8 ++++---- config/protocol_config.go | 4 ++-- config/provider_config.go | 10 +++++----- config/reference_config.go | 8 ++++---- config/registry_config.go | 6 +++--- config/service.go | 6 +++--- config/service_config.go | 6 +++--- 21 files changed, 70 insertions(+), 78 deletions(-) diff --git a/config/application_config.go b/config/application_config.go index 33b47c81dd..f03fc1ec74 100644 --- a/config/application_config.go +++ b/config/application_config.go @@ -25,9 +25,9 @@ import ( "github.com/apache/dubbo-go/common/constant" ) -// ApplicationConfig ... +// ApplicationConfig is a configuration for current application, whether the application is a provider or a consumer type ApplicationConfig struct { - Organization string `yaml:"organization" json:"organization,omitempty" property:"organization"` + Organization string `yaml:"organization" json:"organization,omitempty" property:"organization"` Name string `yaml:"name" json:"name,omitempty" property:"name"` Module string `yaml:"module" json:"module,omitempty" property:"module"` Version string `yaml:"version" json:"version,omitempty" property:"version"` @@ -36,22 +36,12 @@ type ApplicationConfig struct { MetadataType string `default:"local" yaml:"metadataType" json:"metadataType,omitempty" property:"metadataType"` //field for metadata report } -// Prefix ... +// Prefix returns ApplicationConfig prefix func (*ApplicationConfig) Prefix() string { return constant.DUBBO + ".application." } -// Id ... -func (c *ApplicationConfig) Id() string { - return "" -} - -// SetId ... -func (c *ApplicationConfig) SetId(id string) { - -} - -// UnmarshalYAML ... +// UnmarshalYAML unmarshal the ApplicationConfig by @unmarshal function func (c *ApplicationConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { if err := defaults.Set(c); err != nil { return err diff --git a/config/base_config.go b/config/base_config.go index 93c0ce6a66..7d9ea30a06 100644 --- a/config/base_config.go +++ b/config/base_config.go @@ -68,8 +68,8 @@ func (c *BaseConfig) startConfigCenter() error { return err } +// prepareEnvironment prepare the environment func (c *BaseConfig) prepareEnvironment() error { - factory := extension.GetConfigCenterFactory(c.ConfigCenterConfig.Protocol) dynamicConfig, err := factory.GetDynamicConfiguration(c.configCenterUrl) config.GetEnvInstance().SetDynamicConfiguration(dynamicConfig) @@ -323,7 +323,7 @@ func (c *BaseConfig) freshInternalConfig(config *config.InmemoryConfiguration) { setFieldValue(val, reflect.Value{}, config) } -// SetFatherConfig ... +// SetFatherConfig sets father config by @fatherConfig func (c *BaseConfig) SetFatherConfig(fatherConfig interface{}) { c.fatherConfig = fatherConfig } diff --git a/config/config_center_config.go b/config/config_center_config.go index 40b9b65171..975e86e91c 100644 --- a/config/config_center_config.go +++ b/config/config_center_config.go @@ -31,7 +31,13 @@ import ( "github.com/apache/dubbo-go/common/constant" ) -// ConfigCenterConfig ... +// ConfigCenterConfig is configuration for config center +// +// ConfigCenter also introduced concepts of namespace and group to better manage Key-Value pairs by group, +// those concepts are already built-in in many professional third-party configuration centers. +// In most cases, namespace is used to isolate different tetants, while group is used to divid the key set from one tetant into groups. +// +// ConfigCenter has currently supported Zookeeper, Nacos, Etcd, Consul, Apollo type ConfigCenterConfig struct { context context.Context Protocol string `required:"true" yaml:"protocol" json:"protocol,omitempty"` @@ -48,7 +54,7 @@ type ConfigCenterConfig struct { timeout time.Duration } -// UnmarshalYAML ... +// UnmarshalYAML unmarshal the ConfigCenterConfig by @unmarshal function func (c *ConfigCenterConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { if err := defaults.Set(c); err != nil { return err @@ -60,7 +66,7 @@ func (c *ConfigCenterConfig) UnmarshalYAML(unmarshal func(interface{}) error) er return nil } -// GetUrlMap ... +// GetUrlMap gets url map from ConfigCenterConfig func (c *ConfigCenterConfig) GetUrlMap() url.Values { urlMap := url.Values{} urlMap.Set(constant.CONFIG_NAMESPACE_KEY, c.Namespace) diff --git a/config/consumer_config.go b/config/consumer_config.go index 1b563054ec..07af0f68f0 100644 --- a/config/consumer_config.go +++ b/config/consumer_config.go @@ -38,7 +38,7 @@ import ( // consumerConfig ///////////////////////// -// ConsumerConfig ... +// ConsumerConfig is Consumer default configuration type ConsumerConfig struct { BaseConfig `yaml:",inline"` Filter string `yaml:"filter" json:"filter,omitempty" property:"filter"` @@ -63,7 +63,7 @@ type ConsumerConfig struct { ConfigType map[string]string `yaml:"config_type" json:"config_type,omitempty" property:"config_type"` } -// UnmarshalYAML ... +// UnmarshalYAML unmarshal the ConsumerConfig by @unmarshal function func (c *ConsumerConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { if err := defaults.Set(c); err != nil { return err @@ -75,17 +75,17 @@ func (c *ConsumerConfig) UnmarshalYAML(unmarshal func(interface{}) error) error return nil } -// Prefix ... +// Prefix returns ConsumerConfig prefix func (*ConsumerConfig) Prefix() string { return constant.ConsumerConfigPrefix } -// SetConsumerConfig ... +// SetConsumerConfig sets consumerConfig by @c func SetConsumerConfig(c ConsumerConfig) { consumerConfig = &c } -// ConsumerInit ... +// ConsumerInit Load config file to init consumer config func ConsumerInit(confConFile string) error { if confConFile == "" { return perrors.Errorf("application configure(consumer) file name is nil") diff --git a/config/generic_service.go b/config/generic_service.go index b66e399f9e..a3332afe04 100644 --- a/config/generic_service.go +++ b/config/generic_service.go @@ -19,18 +19,18 @@ package config import "context" -// GenericService ... +// GenericService uses for generic invoke for service call type GenericService struct { Invoke func(ctx context.Context, req []interface{}) (interface{}, error) `dubbo:"$invoke"` referenceStr string } -// NewGenericService ... +// NewGenericService returns a GenericService instance func NewGenericService(referenceStr string) *GenericService { return &GenericService{referenceStr: referenceStr} } -// Reference ... +// Reference gets referenceStr from GenericService func (u *GenericService) Reference() string { return u.referenceStr } diff --git a/config/graceful_shutdown.go b/config/graceful_shutdown.go index 382f05c8d5..f36625b058 100644 --- a/config/graceful_shutdown.go +++ b/config/graceful_shutdown.go @@ -52,7 +52,7 @@ import ( * We define them by using 'package build' feature https://golang.org/pkg/go/build/ */ -// GracefulShutdownInit ... +// GracefulShutdownInit init for graceful shutdown func GracefulShutdownInit() { signals := make(chan os.Signal, 1) @@ -83,7 +83,7 @@ func GracefulShutdownInit() { }() } -// BeforeShutdown ... +// BeforeShutdown provides processing flow before shutdown func BeforeShutdown() { destroyAllRegistries() @@ -126,10 +126,8 @@ func destroyConsumerProtocols(consumerProtocols *gxset.HashSet) { } } -/** - * destroy the provider's protocol. - * if the protocol is consumer's protocol too, we will keep it. - */ +// destroy the provider's protocol. +// if the protocol is consumer's protocol too, we will keep it func destroyProviderProtocols(consumerProtocols *gxset.HashSet) { logger.Info("Graceful shutdown --- Destroy provider's protocols. ") @@ -215,9 +213,7 @@ func totalTimeout() time.Duration { return timeout } -/* - * we can not get the protocols from consumerConfig because some protocol don't have configuration, like jsonrpc. - */ +// we can not get the protocols from consumerConfig because some protocol don't have configuration, like jsonrpc. func getConsumerProtocols() *gxset.HashSet { result := gxset.NewSet() if consumerConfig == nil || consumerConfig.References == nil { diff --git a/config/graceful_shutdown_config.go b/config/graceful_shutdown_config.go index 6bbabebf25..a1489714f4 100644 --- a/config/graceful_shutdown_config.go +++ b/config/graceful_shutdown_config.go @@ -31,7 +31,7 @@ const ( defaultStepTimeout = 10 * time.Second ) -// ShutdownConfig ... +// ShutdownConfig is configuration for graceful shutdown type ShutdownConfig struct { /* * Total timeout. Even though we don't release all resources, @@ -58,12 +58,12 @@ type ShutdownConfig struct { RequestsFinished bool } -// Prefix ... +// Prefix returns ShutdownConfig prefix func (config *ShutdownConfig) Prefix() string { return constant.ShutdownConfigPrefix } -// GetTimeout ... +// GetTimeout gets timeout in ShutdownConfig func (config *ShutdownConfig) GetTimeout() time.Duration { result, err := time.ParseDuration(config.Timeout) if err != nil { @@ -74,7 +74,7 @@ func (config *ShutdownConfig) GetTimeout() time.Duration { return result } -// GetStepTimeout ... +// GetStepTimeout gets StepTimeout in ShutdownConfig func (config *ShutdownConfig) GetStepTimeout() time.Duration { result, err := time.ParseDuration(config.StepTimeout) if err != nil { diff --git a/config/graceful_shutdown_signal_darwin.go b/config/graceful_shutdown_signal_darwin.go index 8ad79ffa62..6f1fa982a3 100644 --- a/config/graceful_shutdown_signal_darwin.go +++ b/config/graceful_shutdown_signal_darwin.go @@ -23,12 +23,12 @@ import ( ) var ( - // ShutdownSignals ... + // ShutdownSignals receives shutdown signals to process ShutdownSignals = []os.Signal{os.Interrupt, os.Kill, syscall.SIGKILL, syscall.SIGSTOP, syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP, syscall.SIGABRT, syscall.SIGSYS} - // DumpHeapShutdownSignals ... + // DumpHeapShutdownSignals receives shutdown signals to process DumpHeapShutdownSignals = []os.Signal{syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP, syscall.SIGABRT, syscall.SIGSYS} ) diff --git a/config/graceful_shutdown_signal_linux.go b/config/graceful_shutdown_signal_linux.go index 8ad79ffa62..6f1fa982a3 100644 --- a/config/graceful_shutdown_signal_linux.go +++ b/config/graceful_shutdown_signal_linux.go @@ -23,12 +23,12 @@ import ( ) var ( - // ShutdownSignals ... + // ShutdownSignals receives shutdown signals to process ShutdownSignals = []os.Signal{os.Interrupt, os.Kill, syscall.SIGKILL, syscall.SIGSTOP, syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP, syscall.SIGABRT, syscall.SIGSYS} - // DumpHeapShutdownSignals ... + // DumpHeapShutdownSignals receives shutdown signals to process DumpHeapShutdownSignals = []os.Signal{syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP, syscall.SIGABRT, syscall.SIGSYS} ) diff --git a/config/graceful_shutdown_signal_windows.go b/config/graceful_shutdown_signal_windows.go index 815a05ecb2..3136e5ae15 100644 --- a/config/graceful_shutdown_signal_windows.go +++ b/config/graceful_shutdown_signal_windows.go @@ -23,11 +23,11 @@ import ( ) var ( - // ShutdownSignals ... + // ShutdownSignals receives shutdown signals to process ShutdownSignals = []os.Signal{os.Interrupt, os.Kill, syscall.SIGKILL, syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP, syscall.SIGABRT} - // DumpHeapShutdownSignals ... + // DumpHeapShutdownSignals receives shutdown signals to process DumpHeapShutdownSignals = []os.Signal{syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP, syscall.SIGABRT} ) diff --git a/config/instance/metedata_report.go b/config/instance/metedata_report.go index cd54b0a794..4c935d7332 100644 --- a/config/instance/metedata_report.go +++ b/config/instance/metedata_report.go @@ -32,7 +32,7 @@ var ( once sync.Once ) -// GetMetadataReportInstance ... +// GetMetadataReportInstance gets metadata report instance by @url func GetMetadataReportInstance(url *common.URL) metadata.MetadataReport { once.Do(func() { instance = extension.GetMetadataReportFactory(url.Protocol).CreateMetadataReport(url) diff --git a/config/interfaces/config_reader.go b/config/interfaces/config_reader.go index 8b79a17d89..26f5f3f8f8 100644 --- a/config/interfaces/config_reader.go +++ b/config/interfaces/config_reader.go @@ -19,7 +19,7 @@ package interfaces import "bytes" -// ConfigReader +// A ConfigReader interface is used to read config from consumer or provider type ConfigReader interface { ReadConsumerConfig(reader *bytes.Buffer) error ReadProviderConfig(reader *bytes.Buffer) error diff --git a/config/metadata_report_config.go b/config/metadata_report_config.go index 2b926c0b94..e9a9488a8f 100644 --- a/config/metadata_report_config.go +++ b/config/metadata_report_config.go @@ -32,7 +32,7 @@ import ( "github.com/apache/dubbo-go/config/instance" ) -// MethodConfig ... +// MethodConfig is method level configuration type MetadataReportConfig struct { Protocol string `required:"true" yaml:"protocol" json:"protocol,omitempty"` Address string `yaml:"address" json:"address,omitempty" property:"address"` @@ -43,12 +43,12 @@ type MetadataReportConfig struct { Group string `yaml:"group" json:"group,omitempty" property:"group"` } -// Prefix ... +// Prefix returns MetadataReportConfig prefix func (c *MetadataReportConfig) Prefix() string { return constant.MetadataReportPrefix } -// UnmarshalYAML ... +// UnmarshalYAML unmarshal the MetadataReportConfig by @unmarshal function func (c *MetadataReportConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { if err := defaults.Set(c); err != nil { return perrors.WithStack(err) @@ -60,7 +60,7 @@ func (c *MetadataReportConfig) UnmarshalYAML(unmarshal func(interface{}) error) return nil } -// ToUrl ... +// ToUrl transforms MetadataReportConfig to url func (c *MetadataReportConfig) ToUrl() (*common.URL, error) { urlMap := make(url.Values) diff --git a/config/method_config.go b/config/method_config.go index 8f196d9e2c..37078db063 100644 --- a/config/method_config.go +++ b/config/method_config.go @@ -42,7 +42,7 @@ type MethodConfig struct { RequestTimeout string `yaml:"timeout" json:"timeout,omitempty" property:"timeout"` } -// Prefix ... +// Prefix returns MethodConfig prefix func (c *MethodConfig) Prefix() string { if len(c.InterfaceId) != 0 { return constant.DUBBO + "." + c.InterfaceName + "." + c.InterfaceId + "." + c.Name + "." @@ -51,7 +51,7 @@ func (c *MethodConfig) Prefix() string { return constant.DUBBO + "." + c.InterfaceName + "." + c.Name + "." } -// UnmarshalYAML ... +// UnmarshalYAML unmarshal the MethodConfig by @unmarshal function func (c *MethodConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { if err := defaults.Set(c); err != nil { return err diff --git a/config/mock_rpcservice.go b/config/mock_rpcservice.go index 6c43699128..1e21b252f5 100644 --- a/config/mock_rpcservice.go +++ b/config/mock_rpcservice.go @@ -21,20 +21,20 @@ import ( "context" ) -// MockService ... +// MockService mocks the rpc service for test type MockService struct{} -// Reference ... +// Reference mocks the Reference method func (*MockService) Reference() string { return "MockService" } -// GetUser ... +// GetUser mocks the GetUser method func (*MockService) GetUser(ctx context.Context, itf []interface{}, str *struct{}) error { return nil } -// GetUser1 ... +// GetUser1 mocks the GetUser1 method func (*MockService) GetUser1(ctx context.Context, itf []interface{}, str *struct{}) error { return nil } diff --git a/config/protocol_config.go b/config/protocol_config.go index 33de976bc6..4391e3ece1 100644 --- a/config/protocol_config.go +++ b/config/protocol_config.go @@ -25,14 +25,14 @@ import ( "github.com/apache/dubbo-go/common/constant" ) -// ProtocolConfig ... +// ProtocolConfig is protocol configuration type ProtocolConfig struct { Name string `required:"true" yaml:"name" json:"name,omitempty" property:"name"` Ip string `required:"true" yaml:"ip" json:"ip,omitempty" property:"ip"` Port string `required:"true" yaml:"port" json:"port,omitempty" property:"port"` } -// Prefix ... +// Prefix returns ProtocolConfig prefix func (c *ProtocolConfig) Prefix() string { return constant.ProtocolConfigPrefix } diff --git a/config/provider_config.go b/config/provider_config.go index 7956991745..b5c3a93e64 100644 --- a/config/provider_config.go +++ b/config/provider_config.go @@ -36,7 +36,7 @@ import ( // providerConfig ///////////////////////// -// ProviderConfig ... +// ProviderConfig is the default configuration of service provider type ProviderConfig struct { BaseConfig `yaml:",inline"` Filter string `yaml:"filter" json:"filter,omitempty" property:"filter"` @@ -55,7 +55,7 @@ type ProviderConfig struct { ConfigType map[string]string `yaml:"config_type" json:"config_type,omitempty" property:"config_type"` } -// UnmarshalYAML ... +// UnmarshalYAML unmarshal the ProviderConfig by @unmarshal function func (c *ProviderConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { if err := defaults.Set(c); err != nil { return err @@ -67,17 +67,17 @@ func (c *ProviderConfig) UnmarshalYAML(unmarshal func(interface{}) error) error return nil } -// Prefix ... +// Prefix returns ProviderConfig prefix func (*ProviderConfig) Prefix() string { return constant.ProviderConfigPrefix } -// SetProviderConfig ... +// SetProviderConfig sets provider config by @p func SetProviderConfig(p ProviderConfig) { providerConfig = &p } -// ProviderInit ... +// ProviderInit load config file to init provider config func ProviderInit(confProFile string) error { if len(confProFile) == 0 { return perrors.Errorf("application configure(provider) file name is nil") diff --git a/config/reference_config.go b/config/reference_config.go index 3710cbc4bc..b245f0e52c 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -39,7 +39,7 @@ import ( "github.com/apache/dubbo-go/protocol" ) -// ReferenceConfig ... +// ReferenceConfig is the configuration of service consumer type ReferenceConfig struct { context context.Context pxy *proxy.Proxy @@ -66,7 +66,7 @@ type ReferenceConfig struct { ForceTag bool `yaml:"force.tag" json:"force.tag,omitempty" property:"force.tag"` } -// Prefix ... +// Prefix is ReferenceConfig prefix func (c *ReferenceConfig) Prefix() string { return constant.ReferenceConfigPrefix + c.InterfaceName + "." } @@ -76,7 +76,7 @@ func NewReferenceConfig(id string, ctx context.Context) *ReferenceConfig { return &ReferenceConfig{id: id, context: ctx} } -// UnmarshalYAML ... +// UnmarshalYAML unmarshal the ReferenceConfig by @unmarshal function func (c *ReferenceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { type rf ReferenceConfig raw := rf{} // Put your defaults here @@ -168,7 +168,7 @@ func (c *ReferenceConfig) Implement(v common.RPCService) { c.pxy.Implement(v) } -// GetRPCService ... +// GetRPCService gets RPCService from proxy func (c *ReferenceConfig) GetRPCService() common.RPCService { return c.pxy.Get() } diff --git a/config/registry_config.go b/config/registry_config.go index e877a2c19d..7979972d0e 100644 --- a/config/registry_config.go +++ b/config/registry_config.go @@ -33,7 +33,7 @@ import ( "github.com/apache/dubbo-go/common/logger" ) -// RegistryConfig ... +// RegistryConfig is the configuration of the registry center type RegistryConfig struct { Protocol string `required:"true" yaml:"protocol" json:"protocol,omitempty" property:"protocol"` // I changed "type" to "protocol" ,the same as "protocol" field in java class RegistryConfig @@ -47,7 +47,7 @@ type RegistryConfig struct { Params map[string]string `yaml:"params" json:"params,omitempty" property:"params"` } -// UnmarshalYAML ... +// UnmarshalYAML unmarshal the RegistryConfig by @unmarshal function func (c *RegistryConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { if err := defaults.Set(c); err != nil { return err @@ -59,7 +59,7 @@ func (c *RegistryConfig) UnmarshalYAML(unmarshal func(interface{}) error) error return nil } -// Prefix ... +// Prefix returns RegistryConfig prefix func (*RegistryConfig) Prefix() string { return constant.RegistryConfigPrefix + "|" + constant.SingleRegistryConfigPrefix } diff --git a/config/service.go b/config/service.go index b7e7dc2a42..b746141dd0 100644 --- a/config/service.go +++ b/config/service.go @@ -36,17 +36,17 @@ func SetProviderService(service common.RPCService) { proServices[service.Reference()] = service } -// GetConsumerService ... +// GetConsumerService gets ConsumerService by @name func GetConsumerService(name string) common.RPCService { return conServices[name] } -// GetProviderService ... +// GetProviderService gets ProviderService by @name func GetProviderService(name string) common.RPCService { return proServices[name] } -// GetCallback ... +// GetCallback gets CallbackResponse by @name func GetCallback(name string) func(response common.CallbackResponse) { service := GetConsumerService(name) if sv, ok := service.(common.AsyncCallbackService); ok { diff --git a/config/service_config.go b/config/service_config.go index 09308d032e..96bdef4295 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -44,7 +44,7 @@ import ( "github.com/apache/dubbo-go/protocol/protocolwrapper" ) -// ServiceConfig ... +// ServiceConfig is the configuration of the service provider type ServiceConfig struct { context context.Context id string @@ -80,12 +80,12 @@ type ServiceConfig struct { cacheMutex sync.Mutex } -// Prefix ... +// Prefix returns ServiceConfig prefix func (c *ServiceConfig) Prefix() string { return constant.ServiceConfigPrefix + c.InterfaceName + "." } -// UnmarshalYAML ... +// UnmarshalYAML unmarshal the ServiceConfig by @unmarshal function func (c *ServiceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { if err := defaults.Set(c); err != nil { return err From bada6320ac1cd4ea5f0ca919ca8529a0c31b8ea5 Mon Sep 17 00:00:00 2001 From: watermelo <80680489@qq.com> Date: Tue, 2 Jun 2020 23:23:54 +0800 Subject: [PATCH 2/2] Mod: modify inappropriate comments after review --- config/config_center_config.go | 4 ++-- config/consumer_config.go | 2 +- config/reference_config.go | 2 +- config/registry_config.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/config_center_config.go b/config/config_center_config.go index 58b010e35f..56d575e204 100644 --- a/config/config_center_config.go +++ b/config/config_center_config.go @@ -34,8 +34,8 @@ import ( // ConfigCenterConfig is configuration for config center // // ConfigCenter also introduced concepts of namespace and group to better manage Key-Value pairs by group, -// those concepts are already built-in in many professional third-party configuration centers. -// In most cases, namespace is used to isolate different tetants, while group is used to divid the key set from one tetant into groups. +// those configs are already built-in in many professional third-party configuration centers. +// In most cases, namespace is used to isolate different tenants, while group is used to divide the key set from one tenant into groups. // // ConfigCenter has currently supported Zookeeper, Nacos, Etcd, Consul, Apollo type ConfigCenterConfig struct { diff --git a/config/consumer_config.go b/config/consumer_config.go index 9510809027..1453628ab5 100644 --- a/config/consumer_config.go +++ b/config/consumer_config.go @@ -63,7 +63,7 @@ type ConsumerConfig struct { ConfigType map[string]string `yaml:"config_type" json:"config_type,omitempty" property:"config_type"` } -// UnmarshalYAML unmarshal the ConsumerConfig by @unmarshal function +// UnmarshalYAML unmarshals the ConsumerConfig by @unmarshal function func (c *ConsumerConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { if err := defaults.Set(c); err != nil { return err diff --git a/config/reference_config.go b/config/reference_config.go index fe588188bb..5b7a8e9eac 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -76,7 +76,7 @@ func NewReferenceConfig(id string, ctx context.Context) *ReferenceConfig { return &ReferenceConfig{id: id, context: ctx} } -// UnmarshalYAML unmarshal the ReferenceConfig by @unmarshal function +// UnmarshalYAML unmarshals the ReferenceConfig by @unmarshal function func (c *ReferenceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { type rf ReferenceConfig raw := rf{} // Put your defaults here diff --git a/config/registry_config.go b/config/registry_config.go index f95c3004f0..ef527c827e 100644 --- a/config/registry_config.go +++ b/config/registry_config.go @@ -47,7 +47,7 @@ type RegistryConfig struct { Params map[string]string `yaml:"params" json:"params,omitempty" property:"params"` } -// UnmarshalYAML unmarshal the RegistryConfig by @unmarshal function +// UnmarshalYAML unmarshals the RegistryConfig by @unmarshal function func (c *RegistryConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { if err := defaults.Set(c); err != nil { return err