Documentation
¶
Overview ¶
Package local rebuilds the generated files of the repository you are standing in.
No GitHub, no network, no commits: it writes the files and leaves the worktree dirty for whoever ran it to read the diff and decide. That is the difference between this and a maintained run, which tests, commits each task separately and pushes — one is a person asking for their README to be brought up to date, the other is unattended.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Test ¶
Test runs the repository's tests, records the coverage they report in README/badges.md, and rewrites the README if the badge moved.
Separate from Update because measuring is the expensive half: a rebuild of the generated files should not need the test suite, and a measurement should not need a reason.
Types ¶
type Options ¶
type Options struct {
// Holder is the copyright holder written into LICENSE.
Holder string
// Private marks a repository whose README should not carry the badges a
// public one gets. There is no way to ask git, and this runs without
// GitHub, so devtool.json is where it is read from; this is for a
// repository whose file does not say so yet, and it is recorded there.
Private bool
// Coverage is the figure the README badge shows. Left at zero, the
// generator uses what README/badges.md records, and failing that what the
// current badge already claims.
Coverage float64
// Commit turns the rebuild into a run: test, commit each task that
// changed something, and push once at the end, which is what a
// maintained run does. Without it nothing is committed and the worktree
// is left for whoever ran it to read.
Commit bool
// Version is the build doing the work, as the toolchain reports it. It is
// recorded in the repository's definition and compared against what is
// already there, which is how a build that is behind gets told so.
//
// A parameter rather than a call to selfupdate.Version, because a test
// has to be able to be a build it is not.
Version string
// SelfUpdate fetches the newest published build, and is called only when
// the run finds itself behind the one that last maintained the
// repository. Nil means not to try, and the refusal then says to update
// by hand.
//
// A function rather than the updater itself, so a test can be behind
// without a network, and so the caller keeps its own say over which
// module and whether to go direct.
SelfUpdate func(context.Context) (selfupdate.Outcome, error)
// Restart runs the command again as binary, the build SelfUpdate just
// installed, and reports how that run ended, which becomes Update's
// result: this process does no work of its own once it has handed over.
// Nil means not to, and an update then ends in a refusal that says to run
// the command again.
Restart func(ctx context.Context, binary string) error
// Tools and CheckLatest pin the tools devtool.json lists: see
// [maintain.UpdateOptions].
Tools maintain.ToolOps
CheckLatest bool
}
Options are what cannot be worked out from the directory itself.