protodescs

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package protodescs contains miscellaneous helpers for working with descriptors, including both rich descriptors (protoreflect.Descriptor) and descriptor protos (descriptorpb.FileDescriptorProto and friends).

This is home to the odds and ends that don't quite fit anywhere else, such as determining the edition of a file or sorting a set of file descriptor protos so that every file appears after its imports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEdition

GetEdition returns the edition for the given file. If it cannot be determined, descriptorpb.Edition_EDITION_UNKNOWN is returned.

The given protos value is optional. If non-nil, it will be consulted, if necessary, to find the underlying file descriptor proto for the given fd, from which the edition can be queried.

func SortFiles

func SortFiles(files []*descriptorpb.FileDescriptorProto) error

SortFiles topologically sorts the given file descriptor protos, so that every file appears after all of its imports. The result depends only on the order of the given files.

It returns an error if the given files include duplicates (more than one entry with the same path), if any of the files refer to imports which are not present in the given files, or if the imports form a cycle. When it returns an error, the given slice is unchanged.

Types

This section is empty.

Jump to

Keyboard shortcuts

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