diff --git a/config/method_config.go b/config/method_config.go index 99cf0d1349689f69a50d8e13e1c7cc69fbb97667..95479d1b6586683632ede12e9ce469eb5268fb00 100644 --- a/config/method_config.go +++ b/config/method_config.go @@ -16,7 +16,9 @@ */ package config -import "github.com/apache/dubbo-go/common/constant" +import ( + "github.com/apache/dubbo-go/common/constant" +) type MethodConfig struct { InterfaceId string diff --git a/config/protocol_config.go b/config/protocol_config.go index ad050309016ae39662052e6fea3b7746972a8865..6440f3090ddbb0dbbf8564ae816e3e951f60512d 100644 --- a/config/protocol_config.go +++ b/config/protocol_config.go @@ -17,9 +17,11 @@ package config import ( - "github.com/apache/dubbo-go/common/constant" "strings" ) +import ( + "github.com/apache/dubbo-go/common/constant" +) type ProtocolConfig struct { Name string `required:"true" yaml:"name" json:"name,omitempty" property:"name"` diff --git a/config/provider_config.go b/config/provider_config.go index 558d60e670d06fe18831401d7d48a0c23fb38c07..b2f44ea00a7cfdff2763e49fa3b3fa9a14135b1c 100644 --- a/config/provider_config.go +++ b/config/provider_config.go @@ -63,7 +63,7 @@ func GetProviderConfig() ProviderConfig { } func providerInit(confProFile string) error { - if confProFile == "" { + if len(confProFile) == 0 { return perrors.Errorf("application configure(provider) file name is nil") } diff --git a/config/registry_config.go b/config/registry_config.go index 9d7f5e75440854f1231c874fae811338f172e8ce..8d6b1dc2b4d45a1230eff4d1bf4a419d4dd55bee 100644 --- a/config/registry_config.go +++ b/config/registry_config.go @@ -30,7 +30,8 @@ import ( ) type RegistryConfig struct { - Protocol string `required:"true" yaml:"protocol" json:"protocol,omitempty" property:"protocol"` + 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 TimeoutStr string `yaml:"timeout" default:"5s" json:"timeout,omitempty" property:"timeout"` // unit: second Group string `yaml:"group" json:"group,omitempty" property:"group"` //for registry diff --git a/config_center/configuration_parser.go b/config_center/configuration_parser.go index 8c5498512c23032eff779af755176bbbbf24324e..ab02789c9267786c900b57c312b1346ee2653fde 100644 --- a/config_center/configuration_parser.go +++ b/config_center/configuration_parser.go @@ -12,8 +12,7 @@ type ConfigurationParser interface { } //for support properties file in config center -type DefaultConfigurationParser struct { -} +type DefaultConfigurationParser struct{} func (parser *DefaultConfigurationParser) Parse(content string) (map[string]string, error) { properties, err := properties.LoadString(content) diff --git a/config_center/zookeeper/impl.go b/config_center/zookeeper/impl.go index cd386877dcc812f3cb300b0e92ddda6668e1bbcc..6b526b0c67df2d693214295c94dfeb35200ffec4 100644 --- a/config_center/zookeeper/impl.go +++ b/config_center/zookeeper/impl.go @@ -109,16 +109,16 @@ func (c *zookeeperDynamicConfiguration) RemoveListener(key string, listener remo func (c *zookeeperDynamicConfiguration) GetConfig(key string, opts ...config_center.Option) (string, error) { - opions := &config_center.Options{} + tmpOpts := &config_center.Options{} for _, opt := range opts { - opt(opions) + opt(tmpOpts) } /** * when group is not null, we are getting startup configs from Config Center, for example: * group=dubbo, key=dubbo.properties */ - if opions.Group != "" { - key = opions.Group + "/" + key + if len(tmpOpts.Group) != 0 { + key = tmpOpts.Group + "/" + key } else { /** diff --git a/config_center/zookeeper/impl_test.go b/config_center/zookeeper/impl_test.go index f3ca1c744522897bedb8f76902bf543158e400c5..2ef66ae84c79c5d69aeeffce703dccece084e65c 100644 --- a/config_center/zookeeper/impl_test.go +++ b/config_center/zookeeper/impl_test.go @@ -19,13 +19,17 @@ package zookeeper import ( "context" "fmt" + "sync" + "testing" +) +import ( + "github.com/samuel/go-zookeeper/zk" + "github.com/stretchr/testify/assert" +) +import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/config_center" "github.com/apache/dubbo-go/remoting" - "github.com/samuel/go-zookeeper/zk" - "github.com/stretchr/testify/assert" - "sync" - "testing" ) func initZkData(group string, t *testing.T) (*zk.TestCluster, *zookeeperDynamicConfiguration) {