Skip to content

Instantly share code, notes, and snippets.

View KScaesar's full-sized avatar

Caesar M. Tsai KScaesar

View GitHub Profile
@KScaesar
KScaesar / commit-msg
Created July 3, 2024 15:28
check git commit-msg
#!/bin/sh
commit_msg_file=$1
commit_msg=$(cat "$commit_msg_file")
date_regex="^[0-9]{4}-[0-9]{2}-[0-9]{2}"
if ! echo "$commit_msg" | grep -qE "$date_regex"; then
echo "Error: commit message must start with a date in YYYY-MM-DD format."
exit 1
fi
type ReadCacheProxy[Input, ViewModel any] struct {
ReadCache func(input *Input) (output *ViewModel, err error)
ReadDatabase func(input *Input) (output *ViewModel, err error)
WriteCache func(output *ViewModel) error
Key string
Locks *sync.Map
}