You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: desc_resolve.go
    path of file: ./repos/protobuf-go/reflect/protodesc
    
    the code of the file until where you have to start completion: // 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.

package protodesc

import (
	"google.golang.org/protobuf/internal/encoding/defval"
	"google.golang.org/protobuf/internal/errors"
	"google.golang.org/protobuf/internal/filedesc"
	"google.golang.org/protobuf/reflect/protoreflect"
	"google.golang.org/protobuf/reflect/protoregistry"

	"google.golang.org/protobuf/types/descriptorpb"
)

// resolver is a wrapper around a local registry of declarations within the file
// and the remote resolver. The remote resolver is restricted to only return
// descriptors that have been imported.
type resolver struct {
	local   descsByName
	remote  Resolver
	imports importSet

	allowUnresolvable bool
}

func (r *resolver) resolveMessageDependencies(ms []filedesc.Message, mds []*descriptorpb.DescriptorProto) (err error) {
	for i, md := range mds {
		m := &ms[i]
		for j, fd := range md.GetField() {
			f := &m.L2.Fields.List[j]
			if f.L1.Cardinality == protoreflect.Required {
				m.L2.RequiredNumbers.List = append(m.L2.RequiredNumbers.List, f.L1.Number)
			}
			if fd.OneofIndex != nil {
				k := int(fd.GetOneofIndex()
    
func (r *resolver) findTarget(k protoreflect.Kind, scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.Kind, protoreflect.EnumDescriptor, protoreflect.MessageDescriptor, error) {
	switch k {
	case protoreflect.EnumKind:
		ed, err := r.findEnumDescriptor(scope, ref, isWeak)
		if err != nil {
			return 0, nil, nil, err
		}
		return k, ed, nil, nil
	case protoreflect.MessageKind, protoreflect.GroupKind:
		md, err := r.findMessageDescriptor(scope, ref, isWeak)
		if err != nil {
			return 0, nil, nil, err
		}
		return k, nil, md, nil
	case 0:
		// Handle unspecified kinds (possible with parsers that operate
		// on a per-file basis without knowledge of dependencies).
		d, err := r.findDescriptor(scope, ref)
		if err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) {
			return k, filedesc.PlaceholderEnum(ref.FullName()), filedesc.PlaceholderMessage(ref.FullName()), nil
		} else if err == protoregistry.NotFound {
			return 0, nil, nil, errors.New("%q not found", ref.FullName())
		} else if err != nil {
			return 0, nil, nil, err
		}
		switch d := d.(type) {
		case protoreflect.EnumDescriptor:
			return protoreflect.EnumKind, d, nil, nil
		case protoreflect.MessageDescriptor:
			return protoreflect.MessageKind, nil, d, nil
		default:
			return 0, nil, nil, errors.New("unknown kind")
		}
	default:
		if ref != "" {
			return 0, nil, nil, errors.New("target name cannot be specified for %v", k)
		}
		if !k.IsValid() {
			return 0, nil, nil, errors.New("invalid kind: %d", k)
		}
		return k, nil, nil, nil
	}
}