You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by la...@apache.org on 2021/09/09 15:25:44 UTC
[dubbo-go] branch 3.0 updated: Tiny optimization: change type to
Serializer to avoid type assertion (#1448)
This is an automated email from the ASF dual-hosted git repository.
laurence pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/3.0 by this push:
new cab3893 Tiny optimization: change type to Serializer to avoid type assertion (#1448)
cab3893 is described below
commit cab389386ceba3f30d3e8df16c163044f0aaff85
Author: Ming Deng <mi...@gmail.com>
AuthorDate: Thu Sep 9 23:25:36 2021 +0800
Tiny optimization: change type to Serializer to avoid type assertion (#1448)
* build(deps): bump actions/cache from v2.1.4 to v2.1.5
Bumps [actions/cache](https://github.com/actions/cache) from v2.1.4 to v2.1.5.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.4...1a9e2138d905efd099035b49d8b7a3888c653ca8)
Signed-off-by: dependabot[bot] <su...@github.com>
* improve etcd version and change create to put (#1203)
* build(deps): bump github.com/dubbogo/gost from 1.11.14 to 1.11.16 (#1387)
Bumps [github.com/dubbogo/gost](https://github.com/dubbogo/gost) from 1.11.14 to 1.11.16.
- [Release notes](https://github.com/dubbogo/gost/releases)
- [Commits](https://github.com/dubbogo/gost/compare/v1.11.14...v1.11.16)
---
updated-dependencies:
- dependency-name: github.com/dubbogo/gost
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <su...@github.com>
Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
* build(deps): bump google.golang.org/protobuf from 1.26.0 to 1.27.1 (#1386)
Bumps [google.golang.org/protobuf](https://github.com/protocolbuffers/protobuf-go) from 1.26.0 to 1.27.1.
- [Release notes](https://github.com/protocolbuffers/protobuf-go/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf-go/blob/master/release.bash)
- [Commits](https://github.com/protocolbuffers/protobuf-go/compare/v1.26.0...v1.27.1)
---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <su...@github.com>
Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
* build(deps): bump go.etcd.io/etcd/client/v3 from 3.5.0-alpha.0 to 3.5.0 (#1383)
Bumps [go.etcd.io/etcd/client/v3](https://github.com/etcd-io/etcd) from 3.5.0-alpha.0 to 3.5.0.
- [Release notes](https://github.com/etcd-io/etcd/releases)
- [Changelog](https://github.com/etcd-io/etcd/blob/main/CHANGELOG-3.5.md)
- [Commits](https://github.com/etcd-io/etcd/compare/v3.5.0-alpha.0...v3.5.0)
---
updated-dependencies:
- dependency-name: go.etcd.io/etcd/client/v3
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <su...@github.com>
Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
* Tiny optimization: change type to Serializer to avoid type assertion
Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
Co-authored-by: Xin.Zh <dr...@foxmail.com>
Co-authored-by: AlexStocks <al...@foxmail.com>
Co-authored-by: randy <zt...@gmail.com>
---
protocol/dubbo/impl/codec.go | 2 +-
protocol/dubbo/impl/serialization.go | 6 +++---
protocol/dubbo/impl/serialize.go | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/protocol/dubbo/impl/codec.go b/protocol/dubbo/impl/codec.go
index 682d5d9..007bbf3 100644
--- a/protocol/dubbo/impl/codec.go
+++ b/protocol/dubbo/impl/codec.go
@@ -281,6 +281,6 @@ func NewDubboCodec(reader *bufio.Reader) *ProtocolCodec {
pkgType: 0,
bodyLen: 0,
headerRead: false,
- serializer: s.(Serializer),
+ serializer: s,
}
}
diff --git a/protocol/dubbo/impl/serialization.go b/protocol/dubbo/impl/serialization.go
index 325a854..8137a2f 100644
--- a/protocol/dubbo/impl/serialization.go
+++ b/protocol/dubbo/impl/serialization.go
@@ -26,7 +26,7 @@ import (
)
var (
- serializers = make(map[string]interface{})
+ serializers = make(map[string]Serializer)
nameMaps = make(map[byte]string)
)
@@ -37,11 +37,11 @@ func init() {
}
}
-func SetSerializer(name string, serializer interface{}) {
+func SetSerializer(name string, serializer Serializer) {
serializers[name] = serializer
}
-func GetSerializerById(id byte) (interface{}, error) {
+func GetSerializerById(id byte) (Serializer, error) {
name, ok := nameMaps[id]
if !ok {
panic(fmt.Sprintf("serialId %d not found", id))
diff --git a/protocol/dubbo/impl/serialize.go b/protocol/dubbo/impl/serialize.go
index cf211bf..771d91e 100644
--- a/protocol/dubbo/impl/serialize.go
+++ b/protocol/dubbo/impl/serialize.go
@@ -35,6 +35,6 @@ func LoadSerializer(p *DubboPackage) error {
if err != nil {
panic(err)
}
- p.SetSerializer(serializer.(Serializer))
+ p.SetSerializer(serializer)
return nil
}