Source File
checkinit.go
Belonging Package
google.golang.org/protobuf/proto
package proto
import (
)
if == nil {
return nil
}
return checkInitialized(.ProtoReflect())
}
func ( protoreflect.Message) error {
if := protoMethods(); != nil && .CheckInitialized != nil {
, := .CheckInitialized(protoiface.CheckInitializedInput{
Message: ,
})
return
}
return checkInitializedSlow()
}
func ( protoreflect.Message) error {
:= .Descriptor()
:= .Fields()
for , := 0, .RequiredNumbers(); < .Len(); ++ {
:= .ByNumber(.Get())
if !.Has() {
return errors.RequiredNotSet(string(.FullName()))
}
}
var error
.Range(func( protoreflect.FieldDescriptor, protoreflect.Value) bool {
switch {
case .IsList():
if .Message() == nil {
return true
}
for , := 0, .List(); < .Len() && == nil; ++ {
= checkInitialized(.Get().Message())
}
case .IsMap():
if .MapValue().Message() == nil {
return true
}
.Map().Range(func( protoreflect.MapKey, protoreflect.Value) bool {
= checkInitialized(.Message())
return == nil
})
default:
if .Message() == nil {
return true
}
= checkInitialized(.Message())
}
return == nil
})
return
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |