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: weak.go
    path of file: ./repos/sealer/vendor/google.golang.org/protobuf/internal/impl
    
    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 impl

import (
	"fmt"

	"google.golang.org/protobuf/reflect/protoreflect"
	"google.golang.org/protobuf/reflect/protoregistry"
)

// weakFields adds methods to the exported WeakFields type for internal use.
//
// The exported type is an alias to an unnamed type, so methods can'
    
func (Export) SetWeak(w *WeakFields, num protoreflect.FieldNumber, name protoreflect.FullName, m protoreflect.ProtoMessage) {
	if m != nil {
		mt, _ := protoregistry.GlobalTypes.FindMessageByName(name)
		if mt == nil {
			panic(fmt.Sprintf("message %v for weak field is not linked in", name))
		}
		if mt != m.ProtoReflect().Type() {
			panic(fmt.Sprintf("invalid message type for weak field: got %T, want %T", m, mt.Zero().Interface()))
		}
	}
	if m == nil || !m.ProtoReflect().IsValid() {
		delete(*w, int32(num))
		return
	}
	if *w == nil {
		*w = make(weakFields)
	}
	(*w)[int32(num)] = m
}