@@ -18,26 +18,31 @@ import (
1818 "github.com/bufbuild/buf/private/buf/buffetch"
1919)
2020
21+ // ControllerOption is a controller option.
2122type ControllerOption func (* controller )
2223
24+ // WithDisableSymlinks returns a new ControllerOption that
2325func WithDisableSymlinks (disableSymlinks bool ) ControllerOption {
2426 return func (controller * controller ) {
2527 controller .disableSymlinks = disableSymlinks
2628 }
2729}
2830
31+ // WithFileAnnotationErrorFormat returns a new ControllerOption that sets the FileAnnotation format.
2932func WithFileAnnotationErrorFormat (fileAnnotationErrorFormat string ) ControllerOption {
3033 return func (controller * controller ) {
3134 controller .fileAnnotationErrorFormat = fileAnnotationErrorFormat
3235 }
3336}
3437
38+ // WithFileAnnotationsToStdout returns a new ControllerOption that sends FileAnnotations to stdout
3539func WithFileAnnotationsToStdout () ControllerOption {
3640 return func (controller * controller ) {
3741 controller .fileAnnotationsToStdout = true
3842 }
3943}
4044
45+ // WithCopyToInMemory returns a new ControllerOption that copies to memory.
4146func WithCopyToInMemory () ControllerOption {
4247 return func (controller * controller ) {
4348 controller .copyToInMemory = true
@@ -49,37 +54,43 @@ func WithCopyToInMemory() ControllerOption {
4954// TODO FUTURE: split up to per-function.
5055type FunctionOption func (* functionOptions )
5156
57+ // WithTargetPaths returns a new FunctionOption that sets the target paths.
5258func WithTargetPaths (targetPaths []string , targetExcludePaths []string ) FunctionOption {
5359 return func (functionOptions * functionOptions ) {
5460 functionOptions .targetPaths = targetPaths
5561 functionOptions .targetExcludePaths = targetExcludePaths
5662 }
5763}
5864
65+ // WithImageExcludeSourceInfo returns a new FunctionOption that excludes source code info.
5966func WithImageExcludeSourceInfo (imageExcludeSourceInfo bool ) FunctionOption {
6067 return func (functionOptions * functionOptions ) {
6168 functionOptions .imageExcludeSourceInfo = imageExcludeSourceInfo
6269 }
6370}
6471
72+ // WithImageExcludeImports returns a new FunctionOption that excludes imports.
6573func WithImageExcludeImports (imageExcludeImports bool ) FunctionOption {
6674 return func (functionOptions * functionOptions ) {
6775 functionOptions .imageExcludeImports = imageExcludeImports
6876 }
6977}
7078
79+ // WithImageIncludeTypes returns a new FunctionOption that includes the given types.
7180func WithImageIncludeTypes (imageTypes []string ) FunctionOption {
7281 return func (functionOptions * functionOptions ) {
7382 functionOptions .imageIncludeTypes = imageTypes
7483 }
7584}
7685
86+ // WithImageExcludeTypes returns a new FunctionOption that excludes the given types.
7787func WithImageExcludeTypes (imageExcludeTypes []string ) FunctionOption {
7888 return func (functionOptions * functionOptions ) {
7989 functionOptions .imageExcludeTypes = imageExcludeTypes
8090 }
8191}
8292
93+ // WithImageAsFileDescriptorSet returns a new FunctionOption that returns the image as a FileDescriptorSet.
8394func WithImageAsFileDescriptorSet (imageAsFileDescriptorSet bool ) FunctionOption {
8495 return func (functionOptions * functionOptions ) {
8596 functionOptions .imageAsFileDescriptorSet = imageAsFileDescriptorSet
0 commit comments