mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-01 11:58:21 +00:00
f12fb45fd6
Promote the fast-path magic ProtoMethods method to first-class citizen of the protoreflect.Message interface. To avoid polluting the protoreflect package with the various types required by this method, make the necessary protoiface types unnamed and duplicate them in protoreflect. Updates golang/protobuf#1022. Change-Id: I9595bae40b3bc7536d727fb6f99b3bce8f73da87 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/215718 Reviewed-by: Joe Tsai <joetsai@google.com>
20 lines
498 B
Go
20 lines
498 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 {
|
|
return m.ProtoMethods()
|
|
}
|