fdp

package
v0.14.2-0...-12ef1ef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package fdp provides functionality for lowering the IR to a FileDescriptorSet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescriptorProto

func DescriptorProto(file *ir.File, options ...DescriptorOption) (*descriptorpb.FileDescriptorProto, error)

DescriptorProto generates a single *descriptorpb.FileDescriptorProto for the given *ir.File.

func DescriptorProtoBytes

func DescriptorProtoBytes(file *ir.File, options ...DescriptorOption) ([]byte, error)

DescriptorProtoBytes generates a single FileDescriptorProto for file, and returns the result as an encoded byte slice.

The resulting FileDescriptorProto is fully linked: all names are fully-qualified.

func DescriptorSetBytes

func DescriptorSetBytes(files []*ir.File, options ...DescriptorOption) ([]byte, error)

DescriptorSetBytes generates a FileDescriptorSet for the given files, and returns the result as an encoded byte slice.

The resulting FileDescriptorSet is always fully linked: it contains all dependencies except the WKTs, and all names are fully-qualified.

Types

type DescriptorOption

type DescriptorOption interface {
	// contains filtered or unexported methods
}

DescriptorOption is an option to pass to DescriptorSetBytes, DescriptorProtoBytes, or DescriptorProto.

func ExcludeFiles

func ExcludeFiles(exclude Excluder) DescriptorOption

ExcludeFiles excludes the given files from the output of DescriptorSetBytes and DescriptorProto.

func GenerateExtraOptionLocations

func GenerateExtraOptionLocations(flag bool) DescriptorOption

GenerateExtraOptionLocations set whether or not to generate additional locations for elements inside of message literals in option values. This option is a no-op if IncludeSourceCodeInfo is not set.

func IncludeSourceCodeInfo

func IncludeSourceCodeInfo(flag bool) DescriptorOption

IncludeSourceCodeInfo sets whether or not to include google.protobuf.SourceCodeInfo in the output.

type Excluder

type Excluder interface {
	Exclude(*ir.File) bool
}

Excluder is used with ExcludeFiles.

This is an interface, rather than a function, so that implementations can be comparable for use in queries.

type Options

type Options struct {
	// contains filtered or unexported fields
}

Options records a set of [DescriptorOptions].

This type is intended for making options comparable, such as for use in queries.

func (*Options) Apply

func (o *Options) Apply(options ...DescriptorOption) *Options

Apply applies the given DescriptorOption to this *Options.

Nil values are ignored; does nothing if opt is nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL