mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2024-12-28 18:25:46 +00:00
705acadcc7
We change Unmarshal to reset a message by default. * We add a Merge option to UnmarshalOptions for explicit merging. * We speed up Reset by checking for the Reset method. * Remove TODOs in prototext and protojson about reset behavior. Fixes golang/protobuf#890 Change-Id: Ibd8963c741053f564acf061fbdb846699942109c Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/195457 Reviewed-by: Damien Neil <dneil@google.com>
23 lines
557 B
Go
23 lines
557 B
Go
// Copyright 2019 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// The protoreflect build tag disables use of fast-path methods.
|
|
// +build !protoreflect
|
|
|
|
package proto
|
|
|
|
import (
|
|
"google.golang.org/protobuf/reflect/protoreflect"
|
|
"google.golang.org/protobuf/runtime/protoiface"
|
|
)
|
|
|
|
const hasProtoMethods = true
|
|
|
|
func protoMethods(m protoreflect.Message) *protoiface.Methods {
|
|
if x, ok := m.(protoiface.Methoder); ok {
|
|
return x.ProtoMethods()
|
|
}
|
|
return nil
|
|
}
|