Documentation ¶
Overview ¶
Package bufgen does configuration-based generation.
It is used by the buf generate command.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Required PluginConfigs []*PluginConfig }
Config is a configuration.
func ReadConfig ¶
ReadConfig reads the configuration from the OS.
This will first check if the override ends in .json or .yaml, if so, this reads the file at this path and uses it. Otherwise, this assumes this is configuration data in either JSON or YAML format, and unmarshals it.
Only use in CLI tools.
type ExternalConfigV1Beta1 ¶
type ExternalConfigV1Beta1 struct { Version string `json:"version,omitempty" yaml:"version,omitempty"` Plugins []ExternalPluginConfigV1Beta1 `json:"plugins,omitempty" yaml:"plugins,omitempty"` }
ExternalConfigV1Beta1 is an external configuration.
Only use outside of this package for testing.
type ExternalPluginConfigV1Beta1 ¶
type ExternalPluginConfigV1Beta1 struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Out string `json:"out,omitempty" yaml:"out,omitempty"` Opt string `json:"opt,omitempty" yaml:"opt,omitempty"` Path string `json:"path,omitempty" yaml:"path,omitempty"` }
ExternalPluginConfigV1Beta1 is an external plugin configuration.
Only use outside of this package for testing.
type GenerateOption ¶
type GenerateOption func(*generateOptions)
GenerateOption is an option for Generate.
func GenerateWithBaseOutDirPath ¶
func GenerateWithBaseOutDirPath(baseOutDirPath string) GenerateOption
GenerateWithBaseOutDirPath returns a new GenerateOption that uses the given base directory as the output directory.
The default is to use the current directory.
type Generator ¶
type Generator interface { // Generate calls the generation logic. // // The config is assumed to be valid. If created by ReadConfig, it will // always be valid. Generate( ctx context.Context, container app.EnvStdioContainer, config *Config, image bufimage.Image, options ...GenerateOption, ) error }
Generator generates Protobuf stubs based on configurations.