From a68135cfa98513e6e09719180d4e6295d5e44e61 Mon Sep 17 00:00:00 2001 From: "vito.he" <hxmhlt@163.com> Date: Fri, 6 Sep 2019 18:32:31 +0800 Subject: [PATCH] Add:add license header & format code --- common/config/environment.go | 5 ++++- common/config/environment_test.go | 1 + config/base_config.go | 2 ++ config/config_utils.go | 1 + config/consumer_config.go | 2 ++ config/protocol_config.go | 1 + config/registry_config_test.go | 6 +++++- config_center/configuration_listener.go | 18 ++++++++++++++++++ config_center/configurator.go | 17 +++++++++++++++++ config_center/configurator/override.go | 2 ++ config_center/configurator/override_test.go | 2 ++ config_center/dynamic_configuration.go | 1 + config_center/mock_dynamic_config.go | 10 +++++++--- config_center/parser/configuration_parser.go | 19 +++++++++++++++++++ .../parser/configuration_parser_test.go | 18 ++++++++++++++++++ config_center/zookeeper/factory.go | 3 ++- config_center/zookeeper/impl.go | 4 +++- config_center/zookeeper/listener.go | 1 + registry/base_configuration_listener.go | 17 +++++++++++++++++ registry/mock_registry.go | 7 +++++-- registry/protocol/protocol_test.go | 2 +- registry/zookeeper/listener.go | 4 +++- registry/zookeeper/listener_test.go | 17 +++++++++++++++++ 23 files changed, 149 insertions(+), 11 deletions(-) diff --git a/common/config/environment.go b/common/config/environment.go index 77a962a51..a9447aa12 100644 --- a/common/config/environment.go +++ b/common/config/environment.go @@ -19,11 +19,14 @@ package config import ( "container/list" - "github.com/apache/dubbo-go/config_center" "strings" "sync" ) +import ( + "github.com/apache/dubbo-go/config_center" +) + // There is dubbo.properties file and application level config center configuration which higner than normal config center in java. So in java the // configuration sequence will be config center > application level config center > dubbo.properties > spring bean configuration. // But in go, neither the dubbo.properties file or application level config center configuration will not support for the time being. diff --git a/common/config/environment_test.go b/common/config/environment_test.go index ab7cafae8..0e1d679bc 100644 --- a/common/config/environment_test.go +++ b/common/config/environment_test.go @@ -19,6 +19,7 @@ package config import ( "testing" ) + import ( "github.com/stretchr/testify/assert" ) diff --git a/config/base_config.go b/config/base_config.go index 65cc0fe3f..6c85b5e46 100644 --- a/config/base_config.go +++ b/config/base_config.go @@ -21,9 +21,11 @@ import ( "reflect" "strconv" ) + import ( perrors "github.com/pkg/errors" ) + import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/config" diff --git a/config/config_utils.go b/config/config_utils.go index 90837344c..6bc574a54 100644 --- a/config/config_utils.go +++ b/config/config_utils.go @@ -21,6 +21,7 @@ import ( "regexp" "strings" ) + import ( "github.com/apache/dubbo-go/common/constant" ) diff --git a/config/consumer_config.go b/config/consumer_config.go index 55082ffe4..ebeb7fe75 100644 --- a/config/consumer_config.go +++ b/config/consumer_config.go @@ -22,10 +22,12 @@ import ( "path" "time" ) + import ( perrors "github.com/pkg/errors" "gopkg.in/yaml.v2" ) + import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/logger" diff --git a/config/protocol_config.go b/config/protocol_config.go index 6440f3090..b71423670 100644 --- a/config/protocol_config.go +++ b/config/protocol_config.go @@ -19,6 +19,7 @@ package config import ( "strings" ) + import ( "github.com/apache/dubbo-go/common/constant" ) diff --git a/config/registry_config_test.go b/config/registry_config_test.go index f600a21a0..45d38b29c 100644 --- a/config/registry_config_test.go +++ b/config/registry_config_test.go @@ -20,11 +20,15 @@ import ( "fmt" "testing" ) + import ( - "github.com/apache/dubbo-go/common" "github.com/stretchr/testify/assert" ) +import ( + "github.com/apache/dubbo-go/common" +) + func Test_loadRegistries(t *testing.T) { target := "shanghai1" regs := map[string]*RegistryConfig{ diff --git a/config_center/configuration_listener.go b/config_center/configuration_listener.go index 5367ee72d..1419bcdd0 100644 --- a/config_center/configuration_listener.go +++ b/config_center/configuration_listener.go @@ -1,8 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package config_center import ( "fmt" ) + import ( "github.com/apache/dubbo-go/remoting" ) diff --git a/config_center/configurator.go b/config_center/configurator.go index 0b0b1ddee..3ba293ec6 100644 --- a/config_center/configurator.go +++ b/config_center/configurator.go @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package config_center import ( diff --git a/config_center/configurator/override.go b/config_center/configurator/override.go index a4a97294d..458e2f44e 100644 --- a/config_center/configurator/override.go +++ b/config_center/configurator/override.go @@ -19,9 +19,11 @@ package configurator import ( "strings" ) + import ( "github.com/dubbogo/gost/container" ) + import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" diff --git a/config_center/configurator/override_test.go b/config_center/configurator/override_test.go index e03056ded..2790488f2 100644 --- a/config_center/configurator/override_test.go +++ b/config_center/configurator/override_test.go @@ -20,9 +20,11 @@ import ( "context" "testing" ) + import ( "github.com/stretchr/testify/assert" ) + import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" diff --git a/config_center/dynamic_configuration.go b/config_center/dynamic_configuration.go index c3718ee4c..1028b26d9 100644 --- a/config_center/dynamic_configuration.go +++ b/config_center/dynamic_configuration.go @@ -20,6 +20,7 @@ package config_center import ( "time" ) + import ( "github.com/apache/dubbo-go/config_center/parser" ) diff --git a/config_center/mock_dynamic_config.go b/config_center/mock_dynamic_config.go index 7045c48ec..e8f10d45f 100644 --- a/config_center/mock_dynamic_config.go +++ b/config_center/mock_dynamic_config.go @@ -18,14 +18,18 @@ package config_center import ( - "github.com/apache/dubbo-go/common/constant" - "github.com/apache/dubbo-go/remoting" - "gopkg.in/yaml.v2" "sync" ) + +import ( + "gopkg.in/yaml.v2" +) + import ( "github.com/apache/dubbo-go/common" + "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/config_center/parser" + "github.com/apache/dubbo-go/remoting" ) type MockDynamicConfigurationFactory struct{} diff --git a/config_center/parser/configuration_parser.go b/config_center/parser/configuration_parser.go index bc0eb1182..da140da3e 100644 --- a/config_center/parser/configuration_parser.go +++ b/config_center/parser/configuration_parser.go @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package parser import ( @@ -5,11 +22,13 @@ import ( "strconv" "strings" ) + import ( "github.com/magiconair/properties" perrors "github.com/pkg/errors" "gopkg.in/yaml.v2" ) + import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" diff --git a/config_center/parser/configuration_parser_test.go b/config_center/parser/configuration_parser_test.go index 08490e858..7a59ea9b4 100644 --- a/config_center/parser/configuration_parser_test.go +++ b/config_center/parser/configuration_parser_test.go @@ -1,8 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package parser import ( "testing" ) + import ( "github.com/stretchr/testify/assert" ) diff --git a/config_center/zookeeper/factory.go b/config_center/zookeeper/factory.go index ac10d2a76..611f4b978 100644 --- a/config_center/zookeeper/factory.go +++ b/config_center/zookeeper/factory.go @@ -18,13 +18,14 @@ package zookeeper import ( - "github.com/apache/dubbo-go/config_center/parser" "sync" ) + import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/config_center" + "github.com/apache/dubbo-go/config_center/parser" ) func init() { diff --git a/config_center/zookeeper/impl.go b/config_center/zookeeper/impl.go index 1858a5a83..84e4b54e2 100644 --- a/config_center/zookeeper/impl.go +++ b/config_center/zookeeper/impl.go @@ -18,20 +18,22 @@ package zookeeper import ( - "github.com/apache/dubbo-go/config_center/parser" "strings" "sync" "time" ) + import ( perrors "github.com/pkg/errors" "github.com/samuel/go-zookeeper/zk" ) + import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/config_center" + "github.com/apache/dubbo-go/config_center/parser" "github.com/apache/dubbo-go/remoting/zookeeper" ) diff --git a/config_center/zookeeper/listener.go b/config_center/zookeeper/listener.go index 0874f0c2f..7128b6f5a 100644 --- a/config_center/zookeeper/listener.go +++ b/config_center/zookeeper/listener.go @@ -21,6 +21,7 @@ import ( "strings" "sync" ) + import ( "github.com/apache/dubbo-go/config_center" "github.com/apache/dubbo-go/remoting" diff --git a/registry/base_configuration_listener.go b/registry/base_configuration_listener.go index 791996340..925baa219 100644 --- a/registry/base_configuration_listener.go +++ b/registry/base_configuration_listener.go @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package registry import ( diff --git a/registry/mock_registry.go b/registry/mock_registry.go index 29922ef5b..512c452e3 100644 --- a/registry/mock_registry.go +++ b/registry/mock_registry.go @@ -18,13 +18,16 @@ package registry import ( - "github.com/apache/dubbo-go/common/logger" - "go.uber.org/atomic" "time" ) +import ( + "go.uber.org/atomic" +) + import ( "github.com/apache/dubbo-go/common" + "github.com/apache/dubbo-go/common/logger" ) type MockRegistry struct { diff --git a/registry/protocol/protocol_test.go b/registry/protocol/protocol_test.go index 45f9069a7..56d9fe7d1 100644 --- a/registry/protocol/protocol_test.go +++ b/registry/protocol/protocol_test.go @@ -19,7 +19,6 @@ package protocol import ( "context" - "github.com/apache/dubbo-go/remoting" "testing" "time" ) @@ -40,6 +39,7 @@ import ( "github.com/apache/dubbo-go/protocol" "github.com/apache/dubbo-go/protocol/protocolwrapper" "github.com/apache/dubbo-go/registry" + "github.com/apache/dubbo-go/remoting" ) func init() { diff --git a/registry/zookeeper/listener.go b/registry/zookeeper/listener.go index 688ede8b6..857421f07 100644 --- a/registry/zookeeper/listener.go +++ b/registry/zookeeper/listener.go @@ -19,15 +19,17 @@ package zookeeper import ( "context" - "github.com/apache/dubbo-go/config_center" "strings" ) + import ( perrors "github.com/pkg/errors" ) + import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/logger" + "github.com/apache/dubbo-go/config_center" "github.com/apache/dubbo-go/registry" "github.com/apache/dubbo-go/remoting" zk "github.com/apache/dubbo-go/remoting/zookeeper" diff --git a/registry/zookeeper/listener_test.go b/registry/zookeeper/listener_test.go index c30e5d47d..ca8e44268 100644 --- a/registry/zookeeper/listener_test.go +++ b/registry/zookeeper/listener_test.go @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package zookeeper import ( -- GitLab