Documentation
¶
Index ¶
- Variables
- func Dir(dst string, sources ...string) (bool, error)
- func DirNewer(target time.Time, sources ...string) (bool, error)
- func Glob(dst string, globs ...string) (bool, error)
- func GlobNewer(target time.Time, sources ...string) (bool, error)
- func Must(err error)
- func Must1(_ any, err error)
- func Must2(_, _ any, err error)
- func Must3(_, _, _ any, err error)
- func Must4(_, _, _, _ any, err error)
- func NewestModTime(targets ...string) (time.Time, error)
- func OldestModTime(targets ...string) (time.Time, error)
- func Path(dst string, sources ...string) (bool, error)
- func PathNewer(target time.Time, sources ...string) (bool, error)
- type Dependency
- func Fn[T fn](fn T) Dependency
- func Fn1[T fn1[A], A any](fn T, a1 A) Dependency
- func Fn1WithName[T fn1[A], A any](name string, fn T, a1 A) Dependency
- func Fn2[T fn2[A, B], A, B any](fn T, a1 A, a2 B) Dependency
- func Fn2WithName[T fn2[A, B], A, B any](name string, fn T, a1 A, a2 B) Dependency
- func Fn3[T fn3[A, B, C], A, B, C any](fn T, a1 A, a2 B, a3 C) Dependency
- func Fn3WithName[T fn3[A, B, C], A, B, C any](name string, fn T, a1 A, a2 B, a3 C) Dependency
- func Fn4[T fn4[A, B, C, D], A, B, C, D any](fn T, a1 A, a2 B, a3 C, a4 D) Dependency
- func Fn4WithName[T fn4[A, B, C, D], A, B, C, D any](name string, fn T, a1 A, a2 B, a3 C, a4 D) Dependency
- func Fn5[T fn5[A, B, C, D, E], A, B, C, D, E any](fn T, a1 A, a2 B, a3 C, a4 D, a5 E) Dependency
- func Fn5WithName[T fn5[A, B, C, D, E], A, B, C, D, E any](name string, fn T, a1 A, a2 B, a3 C, a4 D, a5 E) Dependency
- func Fn6[T fn6[A, B, C, D, E, F], A, B, C, D, E, F any](fn T, a1 A, a2 B, a3 C, a4 D, a5 E, a6 F) Dependency
- func Fn6WithName[T fn6[A, B, C, D, E, F], A, B, C, D, E, F any](name string, fn T, a1 A, a2 B, a3 C, a4 D, a5 E, a6 F) Dependency
- func FnWithName[T fn](name string, fn T) Dependency
- func Meth[T fn](s any, fn T) Dependency
- func Meth1[T fn1[A], A any](s any, fn T, a1 A) Dependency
- func Meth2[T fn2[A, B], A, B any](s any, fn T, a1 A, a2 B) Dependency
- func Meth3[T fn3[A, B, C], A, B, C any](s any, fn T, a1 A, a2 B, a3 C) Dependency
- func Meth4[T fn4[A, B, C, D], A, B, C, D any](s any, fn T, a1 A, a2 B, a3 C, a4 D) Dependency
- func Meth5[T fn5[A, B, C, D, E], A, B, C, D, E any](s any, fn T, a1 A, a2 B, a3 C, a4 D, a5 E) Dependency
- func Meth6[T fn6[A, B, C, D, E, F], A, B, C, D, E, F any](s any, fn T, a1 A, a2 B, a3 C, a4 D, a5 E, a6 F) Dependency
- type DependencyID
- type DependencyIDer
- type Manager
- func (m *Manager) Call(ctx context.Context, id string, args []string) (err error)
- func (m *Manager) MustRegisterAndRun(ctx context.Context, targetGroups ...any)
- func (m *Manager) ParallelDeps(ctx context.Context, parent DependencyIDer, deps ...Dependency) error
- func (m *Manager) Register(targetGroup ...any) error
- func (m *Manager) RegisterAndRun(ctx context.Context, targetGroups ...any) error
- func (m *Manager) RegisterGoTool(tool, packageURL, version string) error
- func (m *Manager) Run(ctx context.Context) error
- func (m *Manager) SerialDeps(ctx context.Context, parent DependencyIDer, deps ...Dependency) error
- type ManagerOption
- type MustError
- type UnknownTargetError
- type WithLogger
- type WithParallelDeps
- type WithSerialDeps
- type WithSources
- type WithStderr
- type WithStdout
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Dir ¶
Dir reports whether any of the sources have been modified more recently than the destination. If a source or destination is a directory, this function returns true if a source has any file that has been modified more recently than the most recently modified file in dst. If the destination file doesn't exist, it always returns true and nil. It's an error if any of the sources don't exist.
func DirNewer ¶
DirNewer reports whether any item in sources is newer than the target time. Sources are searched recursively and searching stops as soon as any entry is newer than the target.
func Glob ¶
Glob expands each of the globs (file patterns) into individual sources and then calls Path on the result, reporting if any of the resulting sources have been modified more recently than the destination. Syntax for Glob patterns is the same as stdlib's filepath.Glob. Note that Glob does not expand environment variables before globbing -- env var expansion happens during the call to Path. It is an error for any glob to return an empty result.
func GlobNewer ¶
GlobNewer performs glob expansion on each source and passes the results to PathNewer for inspection. It returns the first time PathNewer encounters a newer file.
func NewestModTime ¶
NewestModTime recurses a list of target filesystem objects and finds newest ModTime among them.
func OldestModTime ¶
OldestModTime recurses a list of target filesystem objects and finds the oldest ModTime among them.
func Path ¶
Path first expands environment variables like $FOO or ${FOO}, and then reports if any of the sources have been modified more recently than the destination. Path does not descend into directories, it literally just checks the modtime of each thing you pass to it. If the destination file doesn't exist, it always returns true and nil. It's an error if any of the sources don't exist.
Types ¶
type Dependency ¶
type Dependency interface { DependencyIDer // Executes the dependency. Run(ctx context.Context) error }
Represents a dependency.
func Fn ¶
func Fn[T fn](fn T) Dependency
Wraps a function with no parameters for the dependency handler.
func Fn1 ¶
func Fn1[T fn1[A], A any](fn T, a1 A) Dependency
Wraps a function with one parameter for the dependency handler.
func Fn1WithName ¶
func Fn1WithName[T fn1[A], A any](name string, fn T, a1 A) Dependency
Wraps a function with one parameter and a specific name for the dependency handler.
func Fn2 ¶
func Fn2[T fn2[A, B], A, B any](fn T, a1 A, a2 B) Dependency
Wraps a function with two parameters for the dependency handler.
func Fn2WithName ¶
func Fn2WithName[T fn2[A, B], A, B any](name string, fn T, a1 A, a2 B) Dependency
Wraps a function with two parameters and a specific name for the dependency handler.
func Fn3 ¶
func Fn3[T fn3[A, B, C], A, B, C any](fn T, a1 A, a2 B, a3 C) Dependency
Wraps a function with three parameters for the dependency handler.
func Fn3WithName ¶
func Fn3WithName[T fn3[A, B, C], A, B, C any](name string, fn T, a1 A, a2 B, a3 C) Dependency
Wraps a function with three parameters and a specific name for the dependency handler.
func Fn4 ¶
func Fn4[T fn4[A, B, C, D], A, B, C, D any](fn T, a1 A, a2 B, a3 C, a4 D) Dependency
Wraps a function with four parameters for the dependency handler.
func Fn4WithName ¶
func Fn4WithName[T fn4[A, B, C, D], A, B, C, D any](name string, fn T, a1 A, a2 B, a3 C, a4 D) Dependency
Wraps a function with four parameters and a specific name for the dependency handler.
func Fn5 ¶
func Fn5[T fn5[A, B, C, D, E], A, B, C, D, E any](fn T, a1 A, a2 B, a3 C, a4 D, a5 E) Dependency
Wraps a function with five parameters for the dependency handler.
func Fn5WithName ¶
func Fn5WithName[T fn5[A, B, C, D, E], A, B, C, D, E any](name string, fn T, a1 A, a2 B, a3 C, a4 D, a5 E) Dependency
Wraps a function with five parameters and a specific name for the dependency handler.
func Fn6 ¶
func Fn6[T fn6[A, B, C, D, E, F], A, B, C, D, E, F any](fn T, a1 A, a2 B, a3 C, a4 D, a5 E, a6 F) Dependency
Wraps a function with six parameters for the dependency handler.
func Fn6WithName ¶
func Fn6WithName[T fn6[A, B, C, D, E, F], A, B, C, D, E, F any]( name string, fn T, a1 A, a2 B, a3 C, a4 D, a5 E, a6 F, ) Dependency
Wraps a function with six parameters and a specific name for the dependency handler.
func FnWithName ¶
func FnWithName[T fn](name string, fn T) Dependency
Wraps a function with no parameters and a specific name for the dependency handler.
func Meth ¶
func Meth[T fn](s any, fn T) Dependency
Wraps a struct method with no parameters for the dependency handler.
func Meth1 ¶
func Meth1[T fn1[A], A any](s any, fn T, a1 A) Dependency
Wraps a struct method with one parameters for the dependency handler.
func Meth2 ¶
func Meth2[T fn2[A, B], A, B any](s any, fn T, a1 A, a2 B) Dependency
Wraps a struct method with two parameters for the dependency handler.
func Meth3 ¶
func Meth3[T fn3[A, B, C], A, B, C any](s any, fn T, a1 A, a2 B, a3 C) Dependency
Wraps a struct method with three parameters for the dependency handler.
func Meth4 ¶
func Meth4[T fn4[A, B, C, D], A, B, C, D any](s any, fn T, a1 A, a2 B, a3 C, a4 D) Dependency
Wraps a struct method with four parameters for the dependency handler.
func Meth5 ¶
func Meth5[T fn5[A, B, C, D, E], A, B, C, D, E any](s any, fn T, a1 A, a2 B, a3 C, a4 D, a5 E) Dependency
Wraps a struct method with five parameters for the dependency handler.
func Meth6 ¶
func Meth6[T fn6[A, B, C, D, E, F], A, B, C, D, E, F any](s any, fn T, a1 A, a2 B, a3 C, a4 D, a5 E, a6 F) Dependency
Wraps a struct method with six parameters for the dependency handler.
type DependencyID ¶
type DependencyID string
Uses a string as dependency identifier.
func (DependencyID) ID ¶
func (id DependencyID) ID() string
type DependencyIDer ¶
type DependencyIDer interface { // Unique Identifier to ensure this dependency only executes once. ID() string }
A depdencency that can uniquely identify itself.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager coordinates runnable targets and dependencies.
func (*Manager) MustRegisterAndRun ¶
func (*Manager) ParallelDeps ¶
func (m *Manager) ParallelDeps(ctx context.Context, parent DependencyIDer, deps ...Dependency) error
Executes dependencies in parallel.
func (*Manager) RegisterAndRun ¶
func (*Manager) RegisterGoTool ¶
Register a go tool to be installed. The manager ensures that the tool is go install'ed project local and available in $PATH.
func (*Manager) SerialDeps ¶
func (m *Manager) SerialDeps(ctx context.Context, parent DependencyIDer, deps ...Dependency) error
Executes dependencies one after the other.
type ManagerOption ¶
type ManagerOption interface {
ApplyToManager(m *Manager)
}
type MustError ¶
type MustError struct {
// contains filtered or unexported fields
}
MustError wraps errors from MustX() functions.
type UnknownTargetError ¶
type UnknownTargetError struct {
ID string
}
UnknownTargetError is raised with no target under the given name could be found.
func (*UnknownTargetError) Error ¶
func (t *UnknownTargetError) Error() string
type WithLogger ¶
Provide a custom logger to the Manager.
func (WithLogger) ApplyToManager ¶
func (l WithLogger) ApplyToManager(m *Manager)
type WithParallelDeps ¶
type WithParallelDeps []Dependency
Add dependencies that will be run in parallel. Parallel dependencies are run before Serial dependencies.
func (WithParallelDeps) ApplyToManager ¶
func (pd WithParallelDeps) ApplyToManager(m *Manager)
type WithSerialDeps ¶
type WithSerialDeps []Dependency
Add dependencies that will be run in series. Serial dependencies run after Parallel dependencies.
func (WithSerialDeps) ApplyToManager ¶
func (pd WithSerialDeps) ApplyToManager(m *Manager)
type WithSources ¶
Source code to use for Help generation. Allows the automatic detection of method comments. Example go-embed directive: //go:embed *.go var source embed.FS.
func (WithSources) ApplyToManager ¶
func (s WithSources) ApplyToManager(m *Manager)
type WithStderr ¶
func (WithStderr) ApplyToManager ¶
func (stderr WithStderr) ApplyToManager(m *Manager)
type WithStdout ¶
func (WithStdout) ApplyToManager ¶
func (stdout WithStdout) ApplyToManager(m *Manager)