Documentation ¶
Index ¶
- Variables
- func DiscoverModules(ctx context.Context, moduleDirs []string) ([]moduleconfig.UnvalidatedModuleConfig, error)
- func WalkDir(dir string, skipGitIgnoredFiles bool, ...) error
- type FileChange
- type FileChangeType
- type FileHashes
- type ModifyFilesTransaction
- type WatchEvent
- type WatchEventModuleAdded
- type WatchEventModuleChanged
- type WatchEventModuleRemoved
- type Watcher
Constants ¶
This section is empty.
Variables ¶
var ErrSkip = errors.New("skip directory")
ErrSkip can be returned by the WalkDir callback to skip a file or directory.
Functions ¶
func DiscoverModules ¶
func DiscoverModules(ctx context.Context, moduleDirs []string) ([]moduleconfig.UnvalidatedModuleConfig, error)
DiscoverModules recursively loads all modules under the given directories (or if none provided, the current working directory is used).
Types ¶
type FileChange ¶ added in v0.397.1
type FileChange struct { Change FileChangeType Path string }
func CompareFileHashes ¶
func CompareFileHashes(oldFiles, newFiles FileHashes) []FileChange
CompareFileHashes compares the hashes of the files in the oldFiles and newFiles maps.
Returns all file changes
type FileChangeType ¶
type FileChangeType rune
const ( FileAdded FileChangeType = '+' FileRemoved FileChangeType = '-' FileChanged FileChangeType = '*' )
func (FileChangeType) GoString ¶
func (f FileChangeType) GoString() string
func (FileChangeType) String ¶
func (f FileChangeType) String() string
type FileHashes ¶
func ComputeFileHashes ¶ added in v0.397.1
func ComputeFileHashes(dir string, skipGitIgnoredFiles bool, patterns []string) (FileHashes, error)
ComputeFileHashes computes the SHA256 hash of all files in the given directory.
If skipGitIgnoredFiles is true, files that are ignored by git will be skipped.
type ModifyFilesTransaction ¶
type ModifyFilesTransaction interface { Begin() error ModifiedFiles(paths ...string) error End() error }
ModifyFilesTransaction allows builds to modify files in a module without triggering a watch event. This helps us avoid infinite loops with builds changing files, and those changes triggering new builds.as a no-op
type WatchEvent ¶
type WatchEvent interface {
// contains filtered or unexported methods
}
A WatchEvent is an event that occurs when a module is added, removed, or changed.
type WatchEventModuleAdded ¶
type WatchEventModuleAdded struct {
Config moduleconfig.UnvalidatedModuleConfig
}
type WatchEventModuleChanged ¶
type WatchEventModuleChanged struct { Config moduleconfig.UnvalidatedModuleConfig Changes []FileChange Time time.Time }
func (WatchEventModuleChanged) String ¶ added in v0.397.1
func (c WatchEventModuleChanged) String() string
type WatchEventModuleRemoved ¶
type WatchEventModuleRemoved struct {
Config moduleconfig.UnvalidatedModuleConfig
}
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
func NewWatcher ¶
func (*Watcher) GetTransaction ¶
func (w *Watcher) GetTransaction(moduleDir string) ModifyFilesTransaction