buf

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLanguage

func NewLanguage() language.Language

NewLanguage is called by Gazelle to install this language extension in a binary.

func SetConfigForGazelleConfig

func SetConfigForGazelleConfig(gazelleConfig *config.Config, config *Config)

SetConfigForGazelleConfig is used to associate Config with a gazelle config.

It can be retreived using `GetConfigForGazelleConfig`

Types

type BreakingMode

type BreakingMode int

BreakingMode is the generation strategy for buf_breaking_test

See BreakingModeModule and BreakingModePackage.

const (
	// BreakingModeModule will generate a buf_breaking_test rule for each `buf.yaml`
	// This is the recommended and default strategy.
	BreakingModeModule BreakingMode = iota + 1
	// BreakingModePackage
	BreakingModePackage
)

func ParseBreakingMode

func ParseBreakingMode(s string) (BreakingMode, error)

ParseBreakingMode parses the BreakingMode.

The empty strings defaults to BreakingModeModule.

type BufModule

type BufModule struct {
	Version string      `json:"version,omitempty" yaml:"version,omitempty"`
	Name    string      `json:"name,omitempty" yaml:"name,omitempty"`
	Build   BuildConfig `json:"build,omitempty" yaml:"build,omitempty"`
}

BufModule is the parsed buf.yaml. It currently only supports version, name, and build top-level attributes.

type BuildConfig

type BuildConfig struct {
	Excludes []string `json:"excludes,omitempty" yaml:"excludes,omitempty"`
}

BuildConfig is the build section of the buf.yaml

type Config

type Config struct {
	// Partial `buf.yaml` config applicable to the current directory.
	Module *BufModule
	// The image target to check against. Typically a label pointing to a file.
	BreakingImageTarget string
	// Controls exclude_imports attribute on buf_breaking_test.
	BreakingExcludeImports bool
	// Controls if buf_breaking_test should be generated for each bazel package
	// or should it be generared corresponding to each buf module (default)
	BreakingLimitToInputFiles bool
	// BreakingMode controls the generation of buf_breaking_test.
	// See BreakingModeModule and BreakingModePackage.
	//
	// Defaults to BreakingModeModule.
	BreakingMode BreakingMode
	// ModuleRoot indicates whether the current directory is the root of buf module
	ModuleRoot bool
	// BufConfigFile is for the nearest buf.yaml
	BufConfigFile label.Label
}

Config holds the configuration if the buf gazelle extension

func GetConfigForGazelleConfig

func GetConfigForGazelleConfig(gazelleConfig *config.Config) *Config

GetConfigForGazelleConfig extracts a Config from gazelle config. It will return `nil` if one is not found.

See `SetConfigForGazelleConfig` for setting a Config.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL