Documentation ¶
Index ¶
- Constants
- Variables
- type Controller
- type ControllerOption
- type FunctionOption
- func WithConfigOverride(configOverride string) FunctionOption
- func WithIgnoreAndDisallowV1BufWorkYAMLs() FunctionOption
- func WithImageAsFileDescriptorSet(imageAsFileDescriptorSet bool) FunctionOption
- func WithImageExcludeImports(imageExcludeImports bool) FunctionOption
- func WithImageExcludeSourceInfo(imageExcludeSourceInfo bool) FunctionOption
- func WithImageTypes(imageTypes []string) FunctionOption
- func WithMessageValidation() FunctionOption
- func WithTargetPaths(targetPaths []string, targetExcludePaths []string) FunctionOption
- type ImageWithConfig
Constants ¶
const ( // ExitCodeFileAnnotation is the exit code used when we print file annotations. // // We use a different exit code to be able to distinguish user-parsable errors from system errors. // // TODO FUTURE: Rename to something like "ExitCodeCompileError" as we use this for ImportNotExistErrors as well. ExitCodeFileAnnotation = 100 )
Variables ¶
var ( // ErrFileAnnotation is used when we print file annotations and want to return an error. // // The app package works on the concept that an error results in a non-zero exit // code, and we already print the messages with PrintFileAnnotations, so we do // not want to print any additional error message. // // We also exit with 100 to be able to distinguish user-parsable errors from system errors. ErrFileAnnotation = app.NewError(ExitCodeFileAnnotation, "") )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface { GetWorkspace( ctx context.Context, sourceOrModuleInput string, options ...FunctionOption, ) (bufworkspace.Workspace, error) GetWorkspaceDepManager( ctx context.Context, dirPath string, options ...FunctionOption, ) (bufworkspace.WorkspaceDepManager, error) GetImage( ctx context.Context, input string, options ...FunctionOption, ) (bufimage.Image, error) GetImageForInputConfig( ctx context.Context, inputConfig bufconfig.InputConfig, options ...FunctionOption, ) (bufimage.Image, error) GetImageForWorkspace( ctx context.Context, workspace bufworkspace.Workspace, options ...FunctionOption, ) (bufimage.Image, error) GetTargetImageWithConfigs( ctx context.Context, input string, options ...FunctionOption, ) ([]ImageWithConfig, error) // GetImportableImageFileInfos gets the importable .proto FileInfos for the given input. // // This includes all files that can be possible imported. For example, if a Module // is given, this will return FileInfos for the Module, its dependencies, and all of // the Well-Known Types. // // Returned ImageFileInfos are sorted by Path. GetImportableImageFileInfos( ctx context.Context, input string, options ...FunctionOption, ) ([]bufimage.ImageFileInfo, error) PutImage( ctx context.Context, imageOutput string, image bufimage.Image, options ...FunctionOption, ) error GetMessage( ctx context.Context, schemaImage bufimage.Image, messageInput string, typeName string, defaultMessageEncoding buffetch.MessageEncoding, options ...FunctionOption, ) (proto.Message, buffetch.MessageEncoding, error) PutMessage( ctx context.Context, schemaImage bufimage.Image, messageOutput string, message proto.Message, defaultMessageEncoding buffetch.MessageEncoding, options ...FunctionOption, ) error }
func NewController ¶
func NewController( logger *slog.Logger, container app.EnvStdioContainer, graphProvider bufmodule.GraphProvider, moduleKeyProvider bufmodule.ModuleKeyProvider, moduleDataProvider bufmodule.ModuleDataProvider, commitProvider bufmodule.CommitProvider, wktStore bufwktstore.Store, httpClient *http.Client, httpauthAuthenticator httpauth.Authenticator, gitClonerOptions git.ClonerOptions, options ...ControllerOption, ) (Controller, error)
type ControllerOption ¶
type ControllerOption func(*controller)
func WithCopyToInMemory ¶
func WithCopyToInMemory() ControllerOption
func WithDisableSymlinks ¶
func WithDisableSymlinks(disableSymlinks bool) ControllerOption
func WithFileAnnotationErrorFormat ¶
func WithFileAnnotationErrorFormat(fileAnnotationErrorFormat string) ControllerOption
func WithFileAnnotationsToStdout ¶
func WithFileAnnotationsToStdout() ControllerOption
type FunctionOption ¶
type FunctionOption func(*functionOptions)
TODO FUTURE: split up to per-function.
func WithConfigOverride ¶
func WithConfigOverride(configOverride string) FunctionOption
WithConfigOverride applies the config override.
This flag will only work if no buf.work.yaml is detected, and the buf.yaml is a v1beta1 buf.yaml, v1 buf.yaml, or no buf.yaml. This flag will not work if a buf.work.yaml is detected, or a v2 buf.yaml is detected.
If used with an image or module ref, this has no effect on the build, i.e. excludes are not respected, and the module name is ignored. This matches old behavior.
This implements the soon-to-be-deprected --config flag.
See bufconfig.GetBufYAMLFileForPrefixOrOverride for more details.
*** DO NOT USE THIS OUTSIDE OF THE CLI AND/OR IF YOU DON'T UNDERSTAND IT. *** *** DO NOT ADD THIS TO ANY NEW COMMANDS. ***
Current commands that use this: build, breaking, lint, generate, format, export, ls-breaking-rules, ls-lint-rules.
func WithIgnoreAndDisallowV1BufWorkYAMLs ¶
func WithIgnoreAndDisallowV1BufWorkYAMLs() FunctionOption
WithIgnoreAndDisallowV1BufWorkYAMLs returns a new FunctionOption that says to ignore dependencies from buf.work.yamls at the root of the bucket, and to also disallow directories with buf.work.yamls to be directly targeted.
See bufworkspace.WithIgnoreAndDisallowV1BufWorkYAMLs for more details.
func WithImageAsFileDescriptorSet ¶
func WithImageAsFileDescriptorSet(imageAsFileDescriptorSet bool) FunctionOption
func WithImageExcludeImports ¶
func WithImageExcludeImports(imageExcludeImports bool) FunctionOption
func WithImageExcludeSourceInfo ¶
func WithImageExcludeSourceInfo(imageExcludeSourceInfo bool) FunctionOption
func WithImageTypes ¶
func WithImageTypes(imageTypes []string) FunctionOption
func WithMessageValidation ¶
func WithMessageValidation() FunctionOption
WithMessageValidation returns a new FunctionOption that says to validate the message as it is being read.
We want to do this as part of the read/unmarshal, as protoyaml has specific logic on unmarshal that will pretty print validations.
func WithTargetPaths ¶
func WithTargetPaths(targetPaths []string, targetExcludePaths []string) FunctionOption
type ImageWithConfig ¶
type ImageWithConfig interface { bufimage.Image LintConfig() bufconfig.LintConfig BreakingConfig() bufconfig.BreakingConfig PluginConfigs() []bufconfig.PluginConfig // contains filtered or unexported methods }
ImageWithConfig pairs an Image with lint and breaking configuration.