internal/value: rename the Unwrap method as ProtoUnwrap
Add a Proto prefix before the Unwrap method to reduce the probability that
it would ever conflict with a method of the same name that a
custom implementation of Enum, Message, List, or Map may have.
Change-Id: I628bf8335583f2747ab4589f3e6ff82e4501ce98
Reviewed-on: https://go-review.googlesource.com/c/151817
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/internal/value/list.go b/internal/value/list.go
index ba82b30..dadb05f 100644
--- a/internal/value/list.go
+++ b/internal/value/list.go
@@ -10,7 +10,10 @@
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
)
-func ListOf(p interface{}, c Converter) pref.List {
+func ListOf(p interface{}, c Converter) interface {
+ pref.List
+ Unwrapper
+} {
// TODO: Validate that p is a *[]T?
rv := reflect.ValueOf(p).Elem()
return listReflect{rv, c}
@@ -46,12 +49,7 @@
func (ls listReflect) Truncate(i int) {
ls.v.Set(ls.v.Slice(0, i))
}
-func (ls listReflect) Unwrap() interface{} {
+func (ls listReflect) ProtoUnwrap() interface{} {
return ls.v.Addr().Interface()
}
func (ls listReflect) ProtoMutable() {}
-
-var (
- _ pref.List = listReflect{}
- _ Unwrapper = listReflect{}
-)