sourcehash

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(hashFile, sourceDir string) error

Check computes the hash of sourceDir and compares it to the hash stored in hashFile. Returns a *MismatchError if the hashes differ.

func ComputeHash

func ComputeHash(sourceDir string) (string, error)

ComputeHash produces a deterministic SHA-256 hash over all git-tracked files in sourceDir. Each file contributes its relative path (forward-slash normalized) and its content to the hash, ensuring renames and content changes are detected.

func Write

func Write(hashFile, sourceDir string) error

Write computes the hash of sourceDir and writes it to hashFile.

Types

type MismatchError

type MismatchError struct {
	Stored  string
	Current string
}

MismatchError is returned by Check when the stored hash does not match the computed hash.

func (*MismatchError) Error

func (e *MismatchError) Error() string

Jump to

Keyboard shortcuts

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