diff --git a/cluster/cluster_impl/base_cluster_invoker.go b/cluster/cluster_impl/base_cluster_invoker.go index d42a099bbf71608753e463084c6a403ae9627e01..5bcadee281d6f9cc13fbd67dd4d3e01444de86d0 100644 --- a/cluster/cluster_impl/base_cluster_invoker.go +++ b/cluster/cluster_impl/base_cluster_invoker.go @@ -29,7 +29,6 @@ import ( "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/protocol" - "github.com/apache/dubbo-go/version" ) type baseClusterInvoker struct { @@ -66,8 +65,8 @@ func (invoker *baseClusterInvoker) checkInvokers(invokers []protocol.Invoker, in if len(invokers) == 0 { ip, _ := utils.GetLocalIP() return perrors.Errorf("Failed to invoke the method %v. No provider available for the service %v from "+ - "registry %v on the consumer %v using the dubbo version %v .Please check if the providers have been started and registered.", - invocation.MethodName(), invoker.directory.GetUrl().SubURL.Key(), invoker.directory.GetUrl().String(), ip, version.Version) + "registry %v on the consumer %v using the dubbo constant %v .Please check if the providers have been started and registered.", + invocation.MethodName(), invoker.directory.GetUrl().SubURL.Key(), invoker.directory.GetUrl().String(), ip, constant.Version) } return nil @@ -77,8 +76,8 @@ func (invoker *baseClusterInvoker) checkInvokers(invokers []protocol.Invoker, in func (invoker *baseClusterInvoker) checkWhetherDestroyed() error { if invoker.destroyed.Load() { ip, _ := utils.GetLocalIP() - return perrors.Errorf("Rpc cluster invoker for %v on consumer %v use dubbo version %v is now destroyed! can not invoke any more. ", - invoker.directory.GetUrl().Service(), ip, version.Version) + return perrors.Errorf("Rpc cluster invoker for %v on consumer %v use dubbo constant %v is now destroyed! can not invoke any more. ", + invoker.directory.GetUrl().Service(), ip, constant.Version) } return nil } diff --git a/cluster/cluster_impl/failover_cluster_invoker.go b/cluster/cluster_impl/failover_cluster_invoker.go index 69664269e2ccf362e6b7a12488fe006802d460e2..b29acbf1133fe35f7a380158faacd9b772871a92 100644 --- a/cluster/cluster_impl/failover_cluster_invoker.go +++ b/cluster/cluster_impl/failover_cluster_invoker.go @@ -26,7 +26,6 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/protocol" - "github.com/apache/dubbo-go/version" ) type failoverClusterInvoker struct { diff --git a/common/constant/version.go b/common/constant/version.go new file mode 100644 index 0000000000000000000000000000000000000000..d4c6821e76894cbd82dc5fae09124263b5c6aa0f --- /dev/null +++ b/common/constant/version.go @@ -0,0 +1,24 @@ +/* + * 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 constant + +const ( + Version = "2.6.0" + Name = "dubbogo" + DATE = "2019/05/06" +) diff --git a/config/config_loader.go b/config/config_loader.go index 720f65f5de6b24b445b7ce07dd2daaba0a856681..cabf3d1ed8606093f3235befac1b02f9a0c3a482 100644 --- a/config/config_loader.go +++ b/config/config_loader.go @@ -28,7 +28,6 @@ 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/version" ) var ( @@ -94,7 +93,7 @@ func Load() { checkok = false count++ if count > maxWait { - panic(fmt.Sprintf("Failed to check the status of the service %v . No provider available for the service to the consumer use dubbo version %v", refconfig.InterfaceName, version.Version)) + panic(fmt.Sprintf("Failed to check the status of the service %v . No provider available for the service to the consumer use dubbo constant %v", refconfig.InterfaceName, constant.Version)) } time.Sleep(time.Second * 1) break diff --git a/registry/etcdv3/registry.go b/registry/etcdv3/registry.go index c716653cf9220256f28468f8e322a499eea61299..5802142989e5d8297f027ddecff3d7780070729f 100644 --- a/registry/etcdv3/registry.go +++ b/registry/etcdv3/registry.go @@ -23,7 +23,6 @@ import ( "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/registry" "github.com/apache/dubbo-go/remoting/etcdv3" - "github.com/apache/dubbo-go/version" ) var ( @@ -229,7 +228,7 @@ func (r *etcdV3Registry) registerConsumer(svc common.URL) error { params.Add("protocol", svc.Protocol) params.Add("category", (common.RoleType(common.CONSUMER)).String()) - params.Add("dubbo", "dubbogo-consumer-"+version.Version) + params.Add("dubbo", "dubbogo-consumer-"+constant.Version) encodedURL := url.QueryEscape(fmt.Sprintf("consumer://%s%s?%s", localIP, svc.Path, params.Encode())) dubboPath := fmt.Sprintf("/dubbo/%s/%s", svc.Service(), (common.RoleType(common.CONSUMER)).String()) @@ -266,7 +265,7 @@ func (r *etcdV3Registry) registerProvider(svc common.URL) error { params.Add("ip", localIP) params.Add("anyhost", "true") params.Add("category", (common.RoleType(common.PROVIDER)).String()) - params.Add("dubbo", "dubbo-provider-golang-"+version.Version) + params.Add("dubbo", "dubbo-provider-golang-"+constant.Version) params.Add("side", (common.RoleType(common.PROVIDER)).Role()) if len(svc.Methods) == 0 { diff --git a/registry/zookeeper/registry.go b/registry/zookeeper/registry.go index 9ce3ee580ee1abdb413bf80882689df60cf2ea2d..e5dabef826c8d2928e39c088322eb9738dead09c 100644 --- a/registry/zookeeper/registry.go +++ b/registry/zookeeper/registry.go @@ -41,7 +41,6 @@ import ( "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/registry" "github.com/apache/dubbo-go/remoting/zookeeper" - "github.com/apache/dubbo-go/version" ) const ( @@ -233,7 +232,7 @@ func (r *zkRegistry) Register(conf common.URL) error { // Check if the service has been registered r.cltLock.Lock() // 注意此处与consumerZookeeperRegistry的差异,consumer用的是conf.Path, - // 因为consumer要提供watch功能给selector使用, provider允许注册同一个service的多个group or version + // 因为consumer要提供watch功能给selector使用, provider允许注册同一个service的多个group or constant _, ok = r.services[conf.Key()] r.cltLock.Unlock() if ok { @@ -302,7 +301,7 @@ func (r *zkRegistry) register(c common.URL) error { // DubboRole = [...]string{"consumer", "", "", "provider"} // params.Add("category", (RoleType(PROVIDER)).Role()) params.Add("category", (common.RoleType(common.PROVIDER)).String()) - params.Add("dubbo", "dubbo-provider-golang-"+version.Version) + params.Add("dubbo", "dubbo-provider-golang-"+constant.Version) params.Add("side", (common.RoleType(common.PROVIDER)).Role()) @@ -345,7 +344,7 @@ func (r *zkRegistry) register(c common.URL) error { params.Add("protocol", c.Protocol) params.Add("category", (common.RoleType(common.CONSUMER)).String()) - params.Add("dubbo", "dubbogo-consumer-"+version.Version) + params.Add("dubbo", "dubbogo-consumer-"+constant.Version) rawURL = fmt.Sprintf("consumer://%s%s?%s", localIP, c.Path, params.Encode()) encodedURL = url.QueryEscape(rawURL)