Documentation
¶
Overview ¶
Package projectconfig loads .pbflags.yaml project configuration. The CLI discovers the file by walking up from the working directory, similar to buf.yaml or .goreleaser.yaml.
Index ¶
Constants ¶
const FileName = ".pbflags.yaml"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
FeaturesPath string `yaml:"features_path"`
DescriptorsPath string `yaml:"descriptors_path"`
ProtoPath string `yaml:"proto_path"`
// Package prefixes used by `pb feature new` when scaffolding a new
// .proto file. Both are optional — when missing, the scaffold emits
// `// TODO: set go_package` / `// TODO: set java_package` placeholders
// for the user to fill in. Examples:
// go_package_prefix: github.com/myorg/myapp/gen
// java_package_prefix: org.myorg.myapp
GoPackagePrefix string `yaml:"go_package_prefix"`
JavaPackagePrefix string `yaml:"java_package_prefix"`
// FeatureLayout controls where `pb feature new <name>` writes the
// scaffolded .proto:
// "" or "nested" → {proto_path}/{name}/{name}.proto, one Go package
// per feature (the buf+protoc-gen-go default).
// "flat" → {proto_path}/{name}.proto, all features share
// one Go/Java package (Spotlight-style monorepo).
FeatureLayout string `yaml:"feature_layout"`
}
Config holds project-level pbflags configuration.
func Discover ¶
Discover walks up from startDir looking for .pbflags.yaml. Returns the parsed config and the directory it was found in. Returns a zero Config and empty dir if no file is found (not an error).
func (Config) DescriptorsFile ¶ added in v0.18.0
DescriptorsFile returns the absolute path to the descriptors file, resolved relative to the project root. Returns empty string if descriptors_path is not configured.
func (Config) FeaturesDir ¶
FeaturesDir returns the absolute path to the features directory, resolved relative to the project root. Returns empty string if features_path is not configured.