Documentation
¶
Overview ¶
Package bufsync plans upgrades to the versions buf.gen.yaml pins: remote plugin versions and git input tags. A git input whose repository a go.mod requires as a module follows that module's version instead of a policy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCommand ¶
GenerateCommand returns the directory and command that regenerate template's output.
Types ¶
type Link ¶ added in v0.21.3
type Link struct {
// Change moves the tag to the required version.
Change edit.Change
// Key is the input's git_repo, which buf.policies keys it by.
Key string
// Module is the Go module path, such as github.com/acme/protos.
Module string
// Required is the release go.mod builds against, the highest when several go.mod files
// require the module directly.
Required string
}
Link is a git input tag that follows the version a go.mod requires of the same repository.
func (Link) Drift ¶ added in v0.24.0
Drift describes how l's tag differs from the version go.mod builds against, or "" when it matches.
type Plan ¶
type Plan struct {
Changes []edit.Change
// AllTemplates lists every buf.gen file, all regenerated when buf dep update changes a
// buf.lock, since a template can generate from a module whose deps just moved.
AllTemplates []string
// DepModules lists the directories whose buf.yaml declares deps, for buf dep update.
DepModules []string
// Links lists the git inputs that follow a Go module, as go.mod stood when the plan was
// made. Planner.Links resolves them again once the Go upgrade has run.
Links []Link
Warnings []string
}
Plan is every change a buf upgrade makes, resolved before any file is written.
func (Plan) With ¶ added in v0.21.3
With returns the plan's changes plus each link that moves, sorted by file and line, and the templates they touch. A link drops any planned change on its span, since an input the Go upgrade linked after planning now follows go.mod, even where go.mod leaves the tag in place.
type Planner ¶
type Planner struct {
// Root is the repository directory.
Root string
// Policies maps a remote plugin name or a git_repo URL to a policy name. Unlisted entries
// use latest.
Policies map[string]string
Registry Registry
Run Runner
// Timeout bounds each git tag listing. Zero leaves it unbounded.
Timeout time.Duration
// ListFiles returns the candidate files relative to Root. Nil uses pins.GitFiles.
ListFiles func(root string) ([]string, error)
// GoExclude lists the globs dependencies.go.exclude names. A go.mod they match holds no
// module a git input follows.
GoExclude []string
}
Planner computes a Plan.
func (Planner) Links ¶ added in v0.21.3
Links returns every git input that follows a Go module, resolved against the tree as it stands, so a call after the Go upgrade sees the versions it left. The warnings name inputs that match several modules, which link to none, and buf files it skipped as unparsable.