mtimehash

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 10 Imported by: 0

README

mtimehash

Go Reference Test

CLI to modify files mtime (modification data time) based on the hash of the file content. This make it deterministic regardless of when the file was created or modified.

Instalation

go install github.com/slsyy/mtimehash/cmd/mtimehash@latest

Rationale

go test uses mtimes to determine, if files opened during tests has changed and thus: tests need to be re-run. Unfortunately in a typical CI workflow modifications times are random as git does not preserve them. This makes caching for those tests ineffective, which slows down the test execution

The trick is to set mtime based on the file content hash. This way the mtime is deterministic regardless when the repository was modified/clone, so hit ratio should be much higher.

Usage

Pass a list of files to modify via stdin:

find . -type f | mtimehash

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Process

func Process(input iter.Seq[string], maxUnixTime int64) error

Process input files and update their modification time based on the hash of their content. The modification time is set to the hash modulo maxUnixTime.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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