[ https://issues.apache.org/jira/browse/SCB-182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16312778#comment-16312778 ]
ASF GitHub Bot commented on SCB-182: ------------------------------------ little-cui closed pull request #244: SCB-182 Registry client option 'WithStrKey' will set the wrong key as using non-copy string function. URL: https://github.com/apache/incubator-servicecomb-service-center/pull/244 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/server/error/error.go b/server/error/error.go index 391d1c4c..cdad863b 100644 --- a/server/error/error.go +++ b/server/error/error.go @@ -53,7 +53,7 @@ var errors = map[int32]string{ ErrUnavailableBackend: "Registry service is unavailable", ErrUnavailableQuota: "Quota service is unavailable", - ErrEndpointAlreadyExists: "Endpoint more belong to other service", + ErrEndpointAlreadyExists: "Endpoint is already belong to other service", } const ( diff --git a/server/infra/registry/registry.go b/server/infra/registry/registry.go index d331c8ee..228b4e4a 100644 --- a/server/infra/registry/registry.go +++ b/server/infra/registry/registry.go @@ -229,9 +229,9 @@ func WithNoCache() PluginOpOption { return func(op *PluginOp) { op.Mo func WithWatchCallback(f WatchCallback) PluginOpOption { return func(op *PluginOp) { op.WatchCallback = f } } -func WithStrKey(key string) PluginOpOption { return WithKey(util.StringToBytesWithNoCopy(key)) } -func WithStrEndKey(key string) PluginOpOption { return WithEndKey(util.StringToBytesWithNoCopy(key)) } -func WithStrValue(value string) PluginOpOption { return WithValue(util.StringToBytesWithNoCopy(value)) } +func WithStrKey(key string) PluginOpOption { return WithKey([]byte(key)) } +func WithStrEndKey(key string) PluginOpOption { return WithEndKey([]byte(key)) } +func WithStrValue(value string) PluginOpOption { return WithValue([]byte(value)) } func WithOffset(i int64) PluginOpOption { return func(op *PluginOp) { op.Offset = i } } func WithLimit(i int64) PluginOpOption { return func(op *PluginOp) { op.Limit = i } } func WatchPrefixOpOptions(key string) []PluginOpOption { @@ -305,12 +305,10 @@ func CmpModRev(key []byte) CompareOperation { func CmpVal(key []byte) CompareOperation { return func(op *CompareOp) { op.Key = key; op.Type = CMP_VALUE } } -func CmpStrVer(key string) CompareOperation { return CmpVer(util.StringToBytesWithNoCopy(key)) } -func CmpStrCreateRev(key string) CompareOperation { - return CmpCreateRev(util.StringToBytesWithNoCopy(key)) -} -func CmpStrModRev(key string) CompareOperation { return CmpModRev(util.StringToBytesWithNoCopy(key)) } -func CmpStrVal(key string) CompareOperation { return CmpVal(util.StringToBytesWithNoCopy(key)) } +func CmpStrVer(key string) CompareOperation { return CmpVer([]byte(key)) } +func CmpStrCreateRev(key string) CompareOperation { return CmpCreateRev([]byte(key)) } +func CmpStrModRev(key string) CompareOperation { return CmpModRev([]byte(key)) } +func CmpStrVal(key string) CompareOperation { return CmpVal([]byte(key)) } func OpCmp(opt CompareOperation, result CompareResult, v interface{}) (cmp CompareOp) { opt(&cmp) cmp.Result = result diff --git a/server/service/util/instance_util.go b/server/service/util/instance_util.go index eb5351fd..77e91f7c 100644 --- a/server/service/util/instance_util.go +++ b/server/service/util/instance_util.go @@ -140,7 +140,7 @@ func CheckEndPoints(ctx context.Context, in *pb.RegisterInstanceRequest) (string } endpointValue := ParseEndpointValue(resp.Kvs[0].Value) if in.Instance.ServiceId != endpointValue.serviceId { - return endpointValue.instanceId, "", fmt.Errorf("endpoints more belong to service %s", endpointValue.serviceId) + return endpointValue.instanceId, "", fmt.Errorf("Find the same endpoints in service %s", endpointValue.serviceId) } return endpointValue.instanceId, "", nil } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Registry client option 'WithStrKey' will set the wrong key as using non-copy > string function > -------------------------------------------------------------------------------------------- > > Key: SCB-182 > URL: https://issues.apache.org/jira/browse/SCB-182 > Project: Apache ServiceComb > Issue Type: Bug > Components: Service-Center > Reporter: little-cui > Assignee: little-cui > Fix For: service-center-1.0.0-m1 > > -- This message was sent by Atlassian JIRA (v6.4.14#64029)