Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFileAnnotation ¶
func GetFileAnnotation( ctx context.Context, parserAccessorHandler ParserAccessorHandler, errorWithPos protoparse.ErrorWithPos, ) (bufanalysis.FileAnnotation, error)
GetFileAnnotation gets the FileAnnotation for the ErrorWithPos error.
func GetFileAnnotations ¶
func GetFileAnnotations( ctx context.Context, parserAccessorHandler ParserAccessorHandler, errorsWithPos []protoparse.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 a ParserAccessor for protoparse.
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
// Returns nil if not available.
ModuleIdentity(path string) bufmodule.ModuleIdentity
// Returns empty if not available.
Commit(path string) string
}
ParserAccessorHandler handles ParserAccessor operations for protoparse..
func NewParserAccessorHandler ¶
func NewParserAccessorHandler(ctx context.Context, module bufmodule.Module) ParserAccessorHandler
NewParserAccessorHandler returns a new ParserAccessorHandler.
The given module should be a bufmodule.ModuleFileSet for image builds, as it needs access to not just the target files, but all dependency files as well.
For AST building, this can just be a bufmodule.Module.
Click to show internal directories.
Click to hide internal directories.