buf

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 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"`
	// V1
	Name  string      `json:"name,omitempty" yaml:"name,omitempty"`
	Build BuildConfig `json:"build,omitempty" yaml:"build,omitempty"`
	// V2
	Modules []ModuleConfig `json:"modules,omitempty" yaml:"modules,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
	// Path to the nearest module root.
	//
	// Only applies to v2.
	ModuleConfig *ModuleConfig
}

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.

type ModuleConfig added in v0.3.0

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

Jump to

Keyboard shortcuts

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