Use any instead of interface{}
Signed-off-by: chenyahui <cyhone@qq.com>
This commit is contained in:
@ -18,13 +18,13 @@ import "github.com/golang/protobuf/proto"
|
||||
|
||||
type codec struct{}
|
||||
|
||||
func (c *codec) Marshal(v interface{}) ([]byte, error) {
|
||||
func (c *codec) Marshal(v any) ([]byte, error) {
|
||||
b, err := proto.Marshal(v.(proto.Message))
|
||||
sentBytes.Add(float64(len(b)))
|
||||
return b, err
|
||||
}
|
||||
|
||||
func (c *codec) Unmarshal(data []byte, v interface{}) error {
|
||||
func (c *codec) Unmarshal(data []byte, v any) error {
|
||||
receivedBytes.Add(float64(len(data)))
|
||||
return proto.Unmarshal(data, v.(proto.Message))
|
||||
}
|
||||
|
Reference in New Issue
Block a user