Documentation ¶
Index ¶
- func GoPackageImportPathForFile(imageFile bufimage.ImageFile, importPathPrefix string) string
- type Modifier
- func CcEnableArenas(sweeper Sweeper, value bool) Modifier
- func GoPackage(sweeper Sweeper, importPathPrefix string) (Modifier, error)
- func JavaMultipleFiles(sweeper Sweeper, value bool) Modifier
- func JavaOuterClassname(sweeper Sweeper) Modifier
- func JavaPackage(sweeper Sweeper, packagePrefix string) (Modifier, error)
- func Merge(left Modifier, right Modifier) Modifier
- func NewMultiModifier(modifiers ...Modifier) Modifier
- func OptimizeFor(sweeper Sweeper, value descriptorpb.FileOptions_OptimizeMode) Modifier
- type ModifierFunc
- type Sweeper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoPackageImportPathForFile ¶
GoPackageImportPathForFile returns the go_package import path for the given ImageFile. If the package contains a version suffix, and if there are more than two components, concatenate the final two components. Otherwise, we exclude the ';' separator and adopt the default behavior from the import path.
For example, an ImageFile with `package acme.weather.v1;` will include `;weatherv1` in the `go_package` declaration so that the generated package is named as such.
Types ¶
type Modifier ¶
type Modifier interface { // Modify modifies the Image. Modify(context.Context, bufimage.Image) error }
Modifier modifies Images.
func CcEnableArenas ¶
CcEnableArenas returns a Modifier that sets the cc_enable_arenas file option to the given value in all of the files contained in the Image.
func GoPackage ¶
GoPackage returns a Modifier that sets the go_package file option according to the given importPathPrefix.
func JavaMultipleFiles ¶
JavaMultipleFiles returns a Modifier that sets the java_multiple_files file option to the given value in all of the files contained in the Image.
func JavaOuterClassname ¶
JavaOuterClassname returns a Modifier that sets the java_outer_classname file option in all of the files contained in the Image based on the PascalCase of their filename.
func JavaPackage ¶
JavaPackage returns a Modifier that sets the java_package file option according to the given packagePrefix.
func Merge ¶
Merge merges the given modifiers together so that they are run in the order they are provided. This is particularly useful for constructing a modifier from its initial 'nil' value.
var modifier Modifier if config.JavaMultipleFiles { modifier = Merge(modifier, JavaMultipleFiles) }
func NewMultiModifier ¶
NewMultiModifier returns a new Modifier for the given Modifiers.
func OptimizeFor ¶
func OptimizeFor(sweeper Sweeper, value descriptorpb.FileOptions_OptimizeMode) Modifier
OptimizeFor returns a Modifier that sets the optimize_for file option to the given value in all of the files contained in the Image.
type ModifierFunc ¶
ModifierFunc is a convenience type that implements the Modifier interface.
type Sweeper ¶
type Sweeper interface { // Sweep implements the ModifierFunc signature so that the Sweeper // can be used as a Modifier. Sweep(context.Context, bufimage.Image) error // contains filtered or unexported methods }
Sweeper is used to mark-and-sweep SourceCodeInfo_Locations from images.
func NewFileOptionSweeper ¶
func NewFileOptionSweeper() Sweeper
NewFileOptionSweeper constructs a new file option Sweeper that removes the SourceCodeInfo_Locations associated with the marks.