Documentation
¶
Index ¶
- Constants
- Variables
- func ArchiveStatusFlagToModuleArchiveStatusFilter(archiveStatus string) (modulev1.ListLabelsRequest_ArchiveFilter, error)
- func ArchiveStatusFlagToPluginArchiveStatusFilter(archiveStatus string) (pluginv1beta1.ListLabelsRequest_ArchiveFilter, error)
- func ArchiveStatusFlagToPolicyArchiveStatusFilter(archiveStatus string) (policyv1beta1.ListLabelsRequest_ArchiveFilter, error)
- func BindArchiveStatus(flagSet *pflag.FlagSet, addr *string, flagName string)
- func BindAsFileDescriptorSet(flagSet *pflag.FlagSet, addr *bool, flagName string)
- func BindCreateVisibility(flagSet *pflag.FlagSet, addr *string, flagName string, createFlagName string)
- func BindDisableSymlinks(flagSet *pflag.FlagSet, addr *bool, flagName string)
- func BindExcludeImports(flagSet *pflag.FlagSet, addr *bool, flagName string)
- func BindExcludePaths(flagSet *pflag.FlagSet, excludePathsAddr *[]string, ...)
- func BindExcludeSourceInfo(flagSet *pflag.FlagSet, addr *bool, flagName string)
- func BindInputHashtag(flagSet *pflag.FlagSet, addr *string)
- func BindPaths(flagSet *pflag.FlagSet, pathsAddr *[]string, pathsFlagName string)
- func BindStringPointer(flagSet *pflag.FlagSet, name string, value **string, usage string)
- func BindVisibility(flagSet *pflag.FlagSet, addr *string, flagName string, emptyDefault bool)
- func BufYAMLFileExistsForDirPath(ctx context.Context, dirPath string) (bool, error)
- func GetBufWorkYAMLFileForDirPath(ctx context.Context, dirPath string) (bufconfig.BufWorkYAMLFile, error)
- func GetBufYAMLFileForDirPath(ctx context.Context, dirPath string) (bufconfig.BufYAMLFile, error)
- func GetBufYAMLFileForDirPathOrOverride(ctx context.Context, dirPath string, override string) (bufconfig.BufYAMLFile, error)
- func GetInputLong(inputArgDescription string) string
- func GetInputValue(container app.ArgContainer, inputHashtag string, defaultValue string) (string, error)
- func GetModuleConfigAndPluginConfigsForProtocPlugin(ctx context.Context, configOverride string, module string, ...) (bufconfig.ModuleConfig, []bufconfig.PluginConfig, []bufconfig.CheckConfig, ...)
- func GetSourceDirLong(inputArgDescription string) string
- func GetSourceLong(inputArgDescription string) string
- func GetSourceOrModuleLong(inputArgDescription string) string
- func NewAppextContainerForPluginEnv(pluginEnv protoplugin.PluginEnv, appName string, logLevelString string, ...) (appext.Container, error)
- func NewCommitProvider(container appext.Container) (bufmodule.CommitProvider, error)
- func NewConnectClientConfig(container appext.Container) (*connectclient.Config, error)
- func NewConnectClientConfigWithToken(container appext.Container, token string) (*connectclient.Config, error)
- func NewController(container appext.Container, options ...bufctl.ControllerOption) (bufctl.Controller, error)
- func NewGraphProvider(container appext.Container) (bufmodule.GraphProvider, error)
- func NewInvalidRemoteError(err error, remote string, moduleFullName string) error
- func NewLabelNameAlreadyExistsError(name string) error
- func NewLabelNotFoundError(ref bufparse.Ref) error
- func NewModuleDataProvider(container appext.Container) (bufmodule.ModuleDataProvider, error)
- func NewModuleKeyProvider(container appext.Container) (bufmodule.ModuleKeyProvider, error)
- func NewModuleNameAlreadyExistsError(name string) error
- func NewModuleNotFoundError(name string) error
- func NewModuleUploader(container appext.Container) (bufmodule.Uploader, error)
- func NewOrganizationNameAlreadyExistsError(name string) error
- func NewOrganizationNotFoundError(name string) error
- func NewOrganizationOrUserNotFoundError(name string) error
- func NewPluginDataProvider(container appext.Container) (bufplugin.PluginDataProvider, error)
- func NewPluginKeyProvider(container appext.Container) (bufplugin.PluginKeyProvider, error)
- func NewPluginNameAlreadyExistsError(name string) error
- func NewPluginNotFoundError(name string) error
- func NewPluginUploader(container appext.Container) (bufplugin.Uploader, error)
- func NewPolicyDataProvider(container appext.Container) (bufpolicy.PolicyDataProvider, error)
- func NewPolicyKeyProvider(container appext.Container) (bufpolicy.PolicyKeyProvider, error)
- func NewPolicyNameAlreadyExistsError(name string) error
- func NewPolicyNotFoundError(name string) error
- func NewPolicyUploader(container appext.Container) (bufpolicy.Uploader, error)
- func NewRefNotFoundError(ref bufparse.Ref) error
- func NewTokenNotFoundError(tokenID string) error
- func NewTooManyEmptyAnswersError(attempts int) error
- func NewWKTStore(container appext.Container) (bufwktstore.Store, error)
- func NewWasmRuntime(ctx context.Context, container appext.Container) (wasm.Runtime, error)
- func PrintFileAnnotationSetLintConfigIgnoreYAMLV1(writer io.Writer, fileAnnotationSet bufanalysis.FileAnnotationSet) error
- func PrintRules(writer io.Writer, rules []bufcheck.Rule, format string, includeDeprecated bool) error
- func PromptUser(container app.Container, prompt string) (string, error)
- func PromptUserForDelete(container app.Container, entityType string, expectedAnswer string) error
- func PromptUserForPassword(container app.Container, prompt string) (string, error)
- func PutBufYAMLFileForDirPath(ctx context.Context, dirPath string, bufYAMLFile bufconfig.BufYAMLFile) error
- func ValidateErrorFormatFlagLint(errorFormatString string, errorFormatFlagName string) error
- func ValidateRequiredFlag[T comparable](flagName string, value T) error
- func VisibilityFlagToPluginVisibilityAllowUnspecified(visibility string) (pluginv1beta1.PluginVisibility, error)
- func VisibilityFlagToPolicyVisibilityAllowUnspecified(visibility string) (policyv1beta1.PolicyVisibility, error)
- func VisibilityFlagToVisibilityAllowUnspecified(visibility string) (modulev1.ModuleVisibility, error)
- func WarnAlphaCommand(_ context.Context, container appext.Container)
- func WarnBetaCommand(_ context.Context, container appext.Container)
- type ModuleOwner
Constants ¶
const ( // DefaultArchiveStatus is the default archive status. // // This is currently unarchived. DefaultArchiveStatus = unarchivedArchiveStatus )
const Version = "1.66.1-dev"
Version is the CLI version of buf.
Variables ¶
var ( // ErrNotATTY is returned when an input io.Reader is not a TTY where it is expected. ErrNotATTY = errors.New("reader was not a TTY as expected") // ErrNoConfigFile is used when the user tries to execute a command without a configuration file. ErrNoConfigFile = errors.New(`no buf.yaml file discovered in the specified directory`) )
var ( // AllCacheRelDirPaths are all directory paths for all time // concerning the module and plugin caches. // // These are normalized. // These are relative to container.CacheDirPath(). // // This variable is used for clearing the cache. AllCacheRelDirPaths = []string{ v1CacheModuleDataRelDirPath, v1CacheModuleLockRelDirPath, v1CacheModuleSumRelDirPath, v1beta1CacheModuleDataRelDirPath, v1beta1CacheModuleLockRelDirPath, v2CacheModuleRelDirPath, v3CacheCommitsRelDirPath, v3CacheModuleLockRelDirPath, v3CacheModuleRelDirPath, v3CachePluginRelDirPath, v3CachePolicyRelDirPath, v3CacheWKTRelDirPath, v3CacheWasmRuntimeRelDirPath, } )
var AllLintFormatStrings = append( bufanalysis.AllFormatStrings, "config-ignore-yaml", )
AllLintFormatStrings are all format strings for lint.
var AllRuleFormatStrings = []string{
"text",
"json",
}
AllRuleFormatStrings is all rule format strings.
Functions ¶
func ArchiveStatusFlagToModuleArchiveStatusFilter ¶
func ArchiveStatusFlagToModuleArchiveStatusFilter(archiveStatus string) (modulev1.ListLabelsRequest_ArchiveFilter, error)
ArchiveStatusFlagToModuleArchiveStatusFilter parses the given string as a modulev1.ListLabelsRequest_ArchiveFilter.
func ArchiveStatusFlagToPluginArchiveStatusFilter ¶
func ArchiveStatusFlagToPluginArchiveStatusFilter(archiveStatus string) (pluginv1beta1.ListLabelsRequest_ArchiveFilter, error)
ArchiveStatusFlagToPluginArchiveStatusFilter parses the given string as a pluginv1beta1.ListLabelsRequest_ArchiveFilter.
func ArchiveStatusFlagToPolicyArchiveStatusFilter ¶
func ArchiveStatusFlagToPolicyArchiveStatusFilter(archiveStatus string) (policyv1beta1.ListLabelsRequest_ArchiveFilter, error)
ArchiveStatusFlagToPolicyArchiveStatusFilter parses the given string as a pluginv1beta1.ListLabelsRequest_ArchiveFilter.
func BindArchiveStatus ¶
BindArchiveStatus binds the archive-status flag. Kept in this package so we can keep allArchiveStatusStrings private.
func BindAsFileDescriptorSet ¶
BindAsFileDescriptorSet binds the exclude-imports flag.
func BindCreateVisibility ¶
func BindCreateVisibility(flagSet *pflag.FlagSet, addr *string, flagName string, createFlagName string)
BindCreateVisibility binds the create-visibility flag. Kept in this package so we can keep allVisibilityStrings private.
func BindDisableSymlinks ¶
BindDisableSymlinks binds the disable-symlinks flag.
func BindExcludeImports ¶
BindExcludeImports binds the exclude-imports flag.
func BindExcludePaths ¶
func BindExcludePaths( flagSet *pflag.FlagSet, excludePathsAddr *[]string, excludePathsFlagName string, )
BindExcludePaths binds the exclude-path flag.
func BindExcludeSourceInfo ¶
BindExcludeSourceInfo binds the exclude-source-info flag.
func BindInputHashtag ¶
BindInputHashtag binds the input hashtag flag.
This needs to be added to any command that has the input as the first argument. This deals with the situation "buf build -#format=json" which results in a parse error from pflag.
func BindStringPointer ¶
BindStringPointer binds a string pointer flag, which indicates flag presence, i.e. `--flag ""` is not the same as not passing the flag.
This is useful for buf registry organization/module update, where we only modify the fields specified.
Value must not be nil.
func BindVisibility ¶
BindVisibility binds the visibility flag.
func BufYAMLFileExistsForDirPath ¶
BufYAMLFileExistsForDirPath returns true if the buf.yaml file exists at the dir path.
func GetBufWorkYAMLFileForDirPath ¶
func GetBufWorkYAMLFileForDirPath( ctx context.Context, dirPath string, ) (bufconfig.BufWorkYAMLFile, error)
GetBufWorkYAMLFileForDirPath gets the buf.work.yaml file for the directory path.
func GetBufYAMLFileForDirPath ¶
func GetBufYAMLFileForDirPath( ctx context.Context, dirPath string, ) (bufconfig.BufYAMLFile, error)
GetBufYAMLFileForDirPath gets the buf.yaml file for the directory path.
func GetBufYAMLFileForDirPathOrOverride ¶
func GetBufYAMLFileForDirPathOrOverride( ctx context.Context, dirPath string, override string, ) (bufconfig.BufYAMLFile, error)
GetBufYAMLFileForDirPathOrOverride get the buf.yaml file for either the usually-flag-based override, or if the override is not set, the directory path.
func GetInputLong ¶
GetInputLong gets the long command description for an input-based command.
func GetInputValue ¶
func GetInputValue( container app.ArgContainer, inputHashtag string, defaultValue string, ) (string, error)
GetInputValue gets the first arg.
Also parses the special input hashtag flag that deals with the situation "buf build -#format=json". The existence of 0 or 1 args should be handled by the Args field on Command.
func GetModuleConfigAndPluginConfigsForProtocPlugin ¶
func GetModuleConfigAndPluginConfigsForProtocPlugin( ctx context.Context, configOverride string, module string, pluginPathOverrides map[string]string, ) (bufconfig.ModuleConfig, []bufconfig.PluginConfig, []bufconfig.CheckConfig, error)
GetModuleConfigAndPluginConfigsForProtocPlugin gets the bufmodule.ModuleConfig and [bufmodule.PluginConfig]s for the specified module for the protoc plugin implementations.
The caller can provide overrides for plugin paths in the plugin configurations. The protoc plugin implementations do not support remote plugins. Also, for use-cases such as Bazel, access to local binaries might require an explicit path override. So, this allows callers to pass a map of plugin name to local path to override the plugin configuration.
We also return all check configs for the option bufcheck.WithRelatedCheckConfigs to validate the plugin configs when running lint/breaking.
This is the same in both plugins so we just pulled it out to a common spot.
func GetSourceDirLong ¶
GetSourceDirLong gets the long command description for a directory-based command.
func GetSourceLong ¶
GetSourceLong gets the long command description for an input-based command.
func GetSourceOrModuleLong ¶
GetSourceOrModuleLong gets the long command description for an input-based command.
func NewAppextContainerForPluginEnv ¶
func NewAppextContainerForPluginEnv( pluginEnv protoplugin.PluginEnv, appName string, logLevelString string, logFormatString string, ) (appext.Container, error)
NewAppextContainerForPluginEnv creates a new appext.Container for the PluginEnv.
This is used by the protoc plugins.
func NewCommitProvider ¶
func NewCommitProvider(container appext.Container) (bufmodule.CommitProvider, error)
NewCommitProvider returns a new CommitProvider while creating the required cache directories.
func NewConnectClientConfig ¶
func NewConnectClientConfig(container appext.Container) (*connectclient.Config, error)
NewConnectClientConfig creates a new connect.ClientConfig which uses a token reader to look up the token in the container or in netrc based on the address of each individual client. It is then set in the header of all outgoing requests from clients created using this config.
func NewConnectClientConfigWithToken ¶
func NewConnectClientConfigWithToken(container appext.Container, token string) (*connectclient.Config, error)
NewConnectClientConfigWithToken creates a new connect.ClientConfig with a given token. The provided token is set in the header of all outgoing requests from this provider
func NewController ¶
func NewController( container appext.Container, options ...bufctl.ControllerOption, ) (bufctl.Controller, error)
NewController returns a new Controller.
func NewGraphProvider ¶
func NewGraphProvider(container appext.Container) (bufmodule.GraphProvider, error)
NewGraphProvider returns a new GraphProvider.
func NewInvalidRemoteError ¶
NewInvalidRemoteError informs the user that the given remote is invalid.
func NewLabelNameAlreadyExistsError ¶
NewLabelNameAlreadyExistsError informs the user that a label with that name already exists.
func NewLabelNotFoundError ¶
NewLabelNotFoundError informs the user that a Ref does not exist as a label.
func NewModuleDataProvider ¶
func NewModuleDataProvider(container appext.Container) (bufmodule.ModuleDataProvider, error)
NewModuleDataProvider returns a new ModuleDataProvider while creating the required cache directories.
func NewModuleKeyProvider ¶
func NewModuleKeyProvider(container appext.Container) (bufmodule.ModuleKeyProvider, error)
NewModuleKeyProvider returns a new ModuleKeyProvider.
func NewModuleNameAlreadyExistsError ¶
NewModuleNameAlreadyExistsError informs the user that a module with that name already exists.
func NewModuleNotFoundError ¶
NewModuleNotFoundError informs the user that a module with that name does not exist.
func NewModuleUploader ¶
NewModuleUploader returns a new Uploader for ModuleSets.
func NewOrganizationNameAlreadyExistsError ¶
NewOrganizationNameAlreadyExistsError informs the user that an organization with that name already exists.
func NewOrganizationNotFoundError ¶
NewOrganizationNotFoundError informs the user that an organization with that name does not exist.
func NewOrganizationOrUserNotFoundError ¶
NewOrganizationOrUserNotFoundError informs the user that an organization or user with that name does not exist.
func NewPluginDataProvider ¶
func NewPluginDataProvider(container appext.Container) (bufplugin.PluginDataProvider, error)
NewPluginDataProvider returns a new PluginDataProvider while creating the required cache directories.
func NewPluginKeyProvider ¶
func NewPluginKeyProvider(container appext.Container) (bufplugin.PluginKeyProvider, error)
NewPluginKeyProvider returns a new PluginKeyProvider.
func NewPluginNameAlreadyExistsError ¶
NewPluginNameAlreadyExistsError informs the user that a plugin with that name already exists.
func NewPluginNotFoundError ¶
NewPluginNotFoundError informs the user that a plugin with that name does not exist.
func NewPluginUploader ¶
NewPluginUploader returns a new Uploader for Plugins.
func NewPolicyDataProvider ¶
func NewPolicyDataProvider(container appext.Container) (bufpolicy.PolicyDataProvider, error)
NewPolicyDataProvider returns a new PolicyDataProvider while creating the required cache directories.
func NewPolicyKeyProvider ¶
func NewPolicyKeyProvider(container appext.Container) (bufpolicy.PolicyKeyProvider, error)
NewPolicyKeyProvider returns a new PolicyKeyProvider.
func NewPolicyNameAlreadyExistsError ¶
NewPolicyNameAlreadyExistsError informs the user that a policy with that name already exists.
func NewPolicyNotFoundError ¶
NewPolicyNotFoundError informs the user that a plugin with that name does not exist.
func NewPolicyUploader ¶
NewPolicyUploader returns a new Uploader for Policys.
func NewRefNotFoundError ¶
NewRefNotFoundError informs the user that a Ref does not exist.
func NewTokenNotFoundError ¶
NewTokenNotFoundError informs the user that a token with that identifier does not exist.
func NewTooManyEmptyAnswersError ¶
NewTooManyEmptyAnswersError is used when the user does not answer a prompt in the given number of attempts.
func NewWKTStore ¶
func NewWKTStore(container appext.Container) (bufwktstore.Store, error)
NewWKTStore returns a new bufwktstore.Store while creating the required cache directories.
func NewWasmRuntime ¶
NewWasmRuntime returns a new Wasm runtime while creating the required cache directories.
func PrintFileAnnotationSetLintConfigIgnoreYAMLV1 ¶
func PrintFileAnnotationSetLintConfigIgnoreYAMLV1( writer io.Writer, fileAnnotationSet bufanalysis.FileAnnotationSet, ) error
PrintFileAnnotationSetLintConfigIgnoreYAMLV1 prints the FileAnnotationSet to the Writer for the lint config-ignore-yaml format.
TODO FUTURE: This is messed.
func PrintRules ¶
func PrintRules(writer io.Writer, rules []bufcheck.Rule, format string, includeDeprecated bool) error
PrintRules prints the Rules to the writer given the --format and --include-deprecated flag values.
func PromptUser ¶
PromptUser reads a line from Stdin, prompting the user with the prompt first. The prompt is repeatedly shown until the user provides a non-empty response. ErrNotATTY is returned if the input containers Stdin is not a terminal.
func PromptUserForDelete ¶
PromptUserForDelete is used to receive user confirmation that a specific entity should be deleted. If the user's answer does not match the expected answer, an error is returned. ErrNotATTY is returned if the input containers Stdin is not a terminal.
func PromptUserForPassword ¶
PromptUserForPassword reads a line from Stdin, prompting the user with the prompt first. The prompt is repeatedly shown until the user provides a non-empty response. ErrNotATTY is returned if the input containers Stdin is not a terminal.
func PutBufYAMLFileForDirPath ¶
func PutBufYAMLFileForDirPath( ctx context.Context, dirPath string, bufYAMLFile bufconfig.BufYAMLFile, ) error
PutBufYAMLFileForDirPath write the buf.yaml file to the directory path.
func ValidateErrorFormatFlagLint ¶
ValidateErrorFormatFlagLint validates the error format flag for lint.
func ValidateRequiredFlag ¶
func ValidateRequiredFlag[T comparable](flagName string, value T) error
ValidateRequiredFlag validates that the required flag is set.
func VisibilityFlagToPluginVisibilityAllowUnspecified ¶
func VisibilityFlagToPluginVisibilityAllowUnspecified(visibility string) (pluginv1beta1.PluginVisibility, error)
VisibilityFlagToPluginVisibilityAllowUnspecified parses the given string as a pluginv1.PluginVisibility where an empty string will be parsed as unspecified.
func VisibilityFlagToPolicyVisibilityAllowUnspecified ¶
func VisibilityFlagToPolicyVisibilityAllowUnspecified(visibility string) (policyv1beta1.PolicyVisibility, error)
VisibilityFlagToPolicyVisibilityAllowUnspecified parses the given string as a pluginv1.PolicyVisibility where an empty string will be parsed as unspecified.
func VisibilityFlagToVisibilityAllowUnspecified ¶
func VisibilityFlagToVisibilityAllowUnspecified(visibility string) (modulev1.ModuleVisibility, error)
VisibilityFlagToVisibilityAllowUnspecified parses the given string as a modulev1.ModuleVisibility where an empty string will be parsed as unspecified
func WarnAlphaCommand ¶
WarnAlphaCommand prints a warning for a alpha command unless the alphaSuppressWarningsEnvKey environment variable is set.
Types ¶
type ModuleOwner ¶
type ModuleOwner interface {
// String returns "registry/owner".
fmt.Stringer
// Registry returns the hostname of the BSR instance that this owner is contained within.
Registry() string
// Owner returns the name of the user or organization.
Owner() string
// contains filtered or unexported methods
}
ModuleOwner represents a module owner, consisting of a registry and owner.
This concept used to live in bufmodule but it doesn't really make sense there, as it isn't use anywhere else. We only use this in buf registry organization commands at the moment.
func NewModuleOwner ¶
func NewModuleOwner( registry string, owner string, ) (ModuleOwner, error)
NewModuleOwner returns a new ModuleOwner for the given components.
func ParseModuleOwner ¶
func ParseModuleOwner(moduleOwnerString string) (ModuleOwner, error)
ParseModuleOwner parses a ModuleOwner from a string in the form "registry/owner".