fingerprint

package
v3.54.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidMethod = errors.New("invalid method")

ErrInvalidMethod lets callers that only need a fingerprint value tell a bad method name apart from a checker failing on the sources themselves.

Functions

func Globs added in v3.28.0

func Globs(dir string, globs []*ast.Glob, useGitignore bool) ([]string, error)

Types

type ChecksumChecker

type ChecksumChecker struct {
	// contains filtered or unexported fields
}

ChecksumChecker validates if a task is up to date by calculating its source files checksum

func NewChecksumChecker

func NewChecksumChecker(tempDir string, dry bool) *ChecksumChecker

func (*ChecksumChecker) IsUpToDate

func (checker *ChecksumChecker) IsUpToDate(t *ast.Task) (bool, error)

func (*ChecksumChecker) Kind

func (*ChecksumChecker) Kind() string

func (*ChecksumChecker) OnError

func (checker *ChecksumChecker) OnError(t *ast.Task) error

func (*ChecksumChecker) Value

func (checker *ChecksumChecker) Value(t *ast.Task) (any, error)

type Fingerprinter added in v3.53.0

type Fingerprinter struct {
	// contains filtered or unexported fields
}

A Fingerprinter answers whether a task is up-to-date. It owns the resolution of the fingerprinting method and the checkers behind it.

func NewFingerprinter added in v3.53.0

func NewFingerprinter(
	defaultMethod string,
	tempDir string,
	dry bool,
	logger *logger.Logger,
	opts ...FingerprinterOption,
) *Fingerprinter

NewFingerprinter uses defaultMethod for tasks that don't declare one.

func (*Fingerprinter) Kind added in v3.53.0

func (f *Fingerprinter) Kind(t *ast.Task) string

Kind names the fingerprint variable ("checksum", "timestamp" or "none") the resolved method injects. An invalid method is reported as "checksum" here and rejected by the entry points that build a checker.

func (*Fingerprinter) OnError added in v3.53.0

func (f *Fingerprinter) OnError(t *ast.Task) error

OnError lets the resolved sources checker clean up after a failed run.

func (*Fingerprinter) SourceValue added in v3.53.0

func (f *Fingerprinter) SourceValue(t *ast.Task) (any, error)

SourceValue returns the value of the fingerprint variable for the given task. It is potentially expensive, so only call it when the task references it.

func (*Fingerprinter) UpToDate added in v3.53.0

func (f *Fingerprinter) UpToDate(ctx context.Context, t *ast.Task) (bool, error)

UpToDate considers both the status commands and the sources of a task; one that declares neither never is.

type FingerprinterOption added in v3.53.0

type FingerprinterOption func(*Fingerprinter)

func WithSourcesChecker

func WithSourcesChecker(checker SourcesCheckable) FingerprinterOption

func WithStatusChecker

func WithStatusChecker(checker StatusCheckable) FingerprinterOption

type MockSourcesCheckable

type MockSourcesCheckable struct {
	mock.Mock
}

MockSourcesCheckable is an autogenerated mock type for the SourcesCheckable type

func NewMockSourcesCheckable

func NewMockSourcesCheckable(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockSourcesCheckable

NewMockSourcesCheckable creates a new instance of MockSourcesCheckable. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockSourcesCheckable) EXPECT

func (*MockSourcesCheckable) IsUpToDate

func (_mock *MockSourcesCheckable) IsUpToDate(t *ast.Task) (bool, error)

IsUpToDate provides a mock function for the type MockSourcesCheckable

func (*MockSourcesCheckable) Kind

func (_mock *MockSourcesCheckable) Kind() string

Kind provides a mock function for the type MockSourcesCheckable

func (*MockSourcesCheckable) OnError

func (_mock *MockSourcesCheckable) OnError(t *ast.Task) error

OnError provides a mock function for the type MockSourcesCheckable

func (*MockSourcesCheckable) Value

func (_mock *MockSourcesCheckable) Value(t *ast.Task) (any, error)

Value provides a mock function for the type MockSourcesCheckable

type MockSourcesCheckable_Expecter added in v3.43.0

type MockSourcesCheckable_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockSourcesCheckable_Expecter) IsUpToDate added in v3.43.0

IsUpToDate is a helper method to define mock.On call

  • t

func (*MockSourcesCheckable_Expecter) Kind added in v3.43.0

Kind is a helper method to define mock.On call

func (*MockSourcesCheckable_Expecter) OnError added in v3.43.0

OnError is a helper method to define mock.On call

  • t

func (*MockSourcesCheckable_Expecter) Value added in v3.43.0

Value is a helper method to define mock.On call

  • t

type MockSourcesCheckable_IsUpToDate_Call added in v3.43.0

type MockSourcesCheckable_IsUpToDate_Call struct {
	*mock.Call
}

MockSourcesCheckable_IsUpToDate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsUpToDate'

func (*MockSourcesCheckable_IsUpToDate_Call) Return added in v3.43.0

func (*MockSourcesCheckable_IsUpToDate_Call) Run added in v3.43.0

func (*MockSourcesCheckable_IsUpToDate_Call) RunAndReturn added in v3.43.0

type MockSourcesCheckable_Kind_Call added in v3.43.0

type MockSourcesCheckable_Kind_Call struct {
	*mock.Call
}

MockSourcesCheckable_Kind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Kind'

func (*MockSourcesCheckable_Kind_Call) Return added in v3.43.0

func (*MockSourcesCheckable_Kind_Call) Run added in v3.43.0

func (*MockSourcesCheckable_Kind_Call) RunAndReturn added in v3.43.0

type MockSourcesCheckable_OnError_Call added in v3.43.0

type MockSourcesCheckable_OnError_Call struct {
	*mock.Call
}

MockSourcesCheckable_OnError_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnError'

func (*MockSourcesCheckable_OnError_Call) Return added in v3.43.0

func (*MockSourcesCheckable_OnError_Call) Run added in v3.43.0

func (*MockSourcesCheckable_OnError_Call) RunAndReturn added in v3.43.0

type MockSourcesCheckable_Value_Call added in v3.43.0

type MockSourcesCheckable_Value_Call struct {
	*mock.Call
}

MockSourcesCheckable_Value_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Value'

func (*MockSourcesCheckable_Value_Call) Return added in v3.43.0

func (*MockSourcesCheckable_Value_Call) Run added in v3.43.0

func (*MockSourcesCheckable_Value_Call) RunAndReturn added in v3.43.0

type MockStatusCheckable

type MockStatusCheckable struct {
	mock.Mock
}

MockStatusCheckable is an autogenerated mock type for the StatusCheckable type

func NewMockStatusCheckable

func NewMockStatusCheckable(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockStatusCheckable

NewMockStatusCheckable creates a new instance of MockStatusCheckable. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockStatusCheckable) EXPECT

func (*MockStatusCheckable) IsUpToDate

func (_mock *MockStatusCheckable) IsUpToDate(ctx context.Context, t *ast.Task) (bool, error)

IsUpToDate provides a mock function for the type MockStatusCheckable

type MockStatusCheckable_Expecter added in v3.43.0

type MockStatusCheckable_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockStatusCheckable_Expecter) IsUpToDate added in v3.43.0

func (_e *MockStatusCheckable_Expecter) IsUpToDate(ctx interface{}, t interface{}) *MockStatusCheckable_IsUpToDate_Call

IsUpToDate is a helper method to define mock.On call

  • ctx
  • t

type MockStatusCheckable_IsUpToDate_Call added in v3.43.0

type MockStatusCheckable_IsUpToDate_Call struct {
	*mock.Call
}

MockStatusCheckable_IsUpToDate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsUpToDate'

func (*MockStatusCheckable_IsUpToDate_Call) Return added in v3.43.0

func (*MockStatusCheckable_IsUpToDate_Call) Run added in v3.43.0

func (*MockStatusCheckable_IsUpToDate_Call) RunAndReturn added in v3.43.0

type NoneChecker

type NoneChecker struct{}

NoneChecker is a no-op Checker. It will always report that the task is not up-to-date.

func (NoneChecker) IsUpToDate

func (NoneChecker) IsUpToDate(t *ast.Task) (bool, error)

func (NoneChecker) Kind

func (NoneChecker) Kind() string

func (NoneChecker) OnError

func (NoneChecker) OnError(t *ast.Task) error

func (NoneChecker) Value

func (NoneChecker) Value(t *ast.Task) (any, error)

type SourcesCheckable

type SourcesCheckable interface {
	IsUpToDate(t *ast.Task) (bool, error)
	Value(t *ast.Task) (any, error)
	OnError(t *ast.Task) error
	Kind() string
}

SourcesCheckable defines any type that can check if the sources of a task are up-to-date.

func NewSourcesChecker

func NewSourcesChecker(method, tempDir string, dry bool) (SourcesCheckable, error)

type StatusCheckable

type StatusCheckable interface {
	IsUpToDate(ctx context.Context, t *ast.Task) (bool, error)
}

StatusCheckable defines any type that can check if the status of a task is up-to-date.

func NewStatusChecker

func NewStatusChecker(logger *logger.Logger) StatusCheckable

type StatusChecker

type StatusChecker struct {
	// contains filtered or unexported fields
}

func (*StatusChecker) IsUpToDate

func (checker *StatusChecker) IsUpToDate(ctx context.Context, t *ast.Task) (bool, error)

type TimestampChecker

type TimestampChecker struct {
	// contains filtered or unexported fields
}

TimestampChecker checks if any source change compared with the generated files, using file modifications timestamps.

func NewTimestampChecker

func NewTimestampChecker(tempDir string, dry bool) *TimestampChecker

func (*TimestampChecker) IsUpToDate

func (checker *TimestampChecker) IsUpToDate(t *ast.Task) (bool, error)

IsUpToDate implements the Checker interface

func (*TimestampChecker) Kind

func (checker *TimestampChecker) Kind() string

func (*TimestampChecker) OnError

func (*TimestampChecker) OnError(t *ast.Task) error

OnError implements the Checker interface

func (*TimestampChecker) Value

func (checker *TimestampChecker) Value(t *ast.Task) (any, error)

Value implements the Checker Interface

Jump to

Keyboard shortcuts

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