Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAbs ¶
CheckAbs is a convenience functions for determining whether a path is an absolute path.
func IsExcluded ¶
IsExcluded determines whether the given filePath should be excluded.
absConfigDirPath represents the absolute path to the configuration file. This is used to determine when we should stop checking for excludes.
Types ¶
type ProtoFile ¶
type ProtoFile struct { // The path to the .proto file. // Must be absolute. // Must be cleaned. Path string // The path to display in output. // This will be relative to the working directory, or the absolute path // if the file was outside the working directory. DisplayPath string }
ProtoFile represents a .proto file.
type ProtoSet ¶
type ProtoSet struct { // The working directory path. // Must be absolute. // Must be cleaned. WorkDirPath string // The given directory path. // Must be absolute. // Must be cleaned. DirPath string // The directory path to slice of .proto files. // All paths must be absolute. // All paths must reside within DirPath. // Must be cleaned. // The directory paths will always reside within the config DirPath, // that is filepath.Rel(Config.DirPath, DirPath) will never return // error and always return a non-empty string. Note the string could be ".". // The ProtoFiles will always be in the directory specified by the key. DirPathToFiles map[string][]*ProtoFile // The associated Config. // Must be valid. // The DirPath on the config may differ from the DirPath on the ProtoSet. Config settings.Config }
ProtoSet represents a set of .proto files and an associated config.
ProtoSets will be validated if returned from this package.
type ProtoSetProvider ¶
type ProtoSetProvider interface { // GetForDir gets the ProtoSet for the given dirPath. // The ProtoSet will have the config assocated with all files associated with // the ProtoSet. // // This will return all .proto files in the directory of the associated config file // and all it's subdirectories, or the given directory and its subdirectories // if there is no config file. // // Config will be searched for starting at the directory of each .proto file // and going up a directory until hitting root. // Returns an error if there is not exactly one ProtoSet. GetForDir(workDirPath string, dirPath string) (*ProtoSet, error) }
ProtoSetProvider provides ProtoSets.
func NewProtoSetProvider ¶
func NewProtoSetProvider(options ...ProtoSetProviderOption) ProtoSetProvider
NewProtoSetProvider returns a new ProtoSetProvider.
type ProtoSetProviderOption ¶
type ProtoSetProviderOption func(*protoSetProvider)
ProtoSetProviderOption is an option for a new ProtoSetProvider.
func ProtoSetProviderWithConfigData ¶
func ProtoSetProviderWithConfigData(configData string) ProtoSetProviderOption
ProtoSetProviderWithConfigData returns a ProtoSetProviderOption that uses the given configuration data instead of using configuration files that are found. This acts as if there is only one configuration file at the current working directory. All found configuration files are ignored.
func ProtoSetProviderWithDevelMode ¶
func ProtoSetProviderWithDevelMode() ProtoSetProviderOption
ProtoSetProviderWithDevelMode returns a ProtoSetProviderOption that allows devel-mode.
func ProtoSetProviderWithLogger ¶
func ProtoSetProviderWithLogger(logger *zap.Logger) ProtoSetProviderOption
ProtoSetProviderWithLogger returns a ProtoSetProviderOption that uses the given logger.
The default is to use zap.NewNop().
func ProtoSetProviderWithWalkTimeout ¶
func ProtoSetProviderWithWalkTimeout(walkTimeout time.Duration) ProtoSetProviderOption
ProtoSetProviderWithWalkTimeout returns a ProtoSetProviderOption will timeout after walking a directory structure when searching for Protobuf files after the given amount of time.
The default is to timeout after DefaultTimeoutDuration. Set to 0 for no timeout.