bufmoduleprotocompile

package
v0.0.0-...-a078c60 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFileAnnotation

func GetFileAnnotation(
	ctx context.Context,
	parserAccessorHandler ParserAccessorHandler,
	errorWithPos reporter.ErrorWithPos,
) (bufanalysis.FileAnnotation, error)

GetFileAnnotation gets the FileAnnotation for the ErrorWithPos error.

func GetFileAnnotations

func GetFileAnnotations(
	ctx context.Context,
	parserAccessorHandler ParserAccessorHandler,
	errorsWithPos []reporter.ErrorWithPos,
) ([]bufanalysis.FileAnnotation, error)

GetFileAnnotations gets the FileAnnotations for the ErrorWithPos errors.

Types

type ParserAccessorHandler

type ParserAccessorHandler interface {
	// Open opens the given path, and tracks the external path and import status.
	//
	// This function can be used as the accessor function for a protocompile.SourceResolver.
	Open(path string) (io.ReadCloser, error)
	// ExternalPath returns the external path for the input path.
	//
	// Returns the input path if the external path is not known.
	ExternalPath(path string) string
	// IsImport returns true if the path is an import.
	IsImport(path string) bool
	// ModuleIdentity returns nil if not available.
	ModuleIdentity(path string) bufmoduleref.ModuleIdentity
	// Commit returns empty if not available.
	Commit(path string) string
}

ParserAccessorHandler handles source file access operations for protocompile.

func NewParserAccessorHandler

func NewParserAccessorHandler(ctx context.Context, moduleFileSet bufmodule.ModuleFileSet) ParserAccessorHandler

NewParserAccessorHandler returns a new ParserAccessorHandler.

TODO: make this dependent on whatever derivative getter type we create to replace ModuleFileSet.

Jump to

Keyboard shortcuts

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