chore: modernize CI and update Go toolchain

- Bump Go from 1.19 to 1.26 and update all dependencies
- Rewrite CI workflow with matrix strategy (Linux, macOS, Windows)
- Update GitHub Actions to current versions (checkout@v4, setup-go@v5)
- Update CodeQL actions from v1 to v3
- Fix cross-platform bug in mock/path.go (path.Join -> filepath.Join)
- Clean up dependabot config (weekly schedule, remove stale ignore)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Christopher Allen Lane
2026-02-14 20:58:51 -05:00
parent cc85a4bdb1
commit 2a19755804
657 changed files with 49050 additions and 32001 deletions

View File

@@ -38,8 +38,7 @@ type digest struct {
len uint64
// col defines whether a collision has been found.
col bool
blockFunc func(dig *digest, p []byte)
col bool
}
func (d *digest) MarshalBinary() ([]byte, error) {
@@ -99,7 +98,7 @@ func (d *digest) UnmarshalBinary(b []byte) error {
func consumeUint64(b []byte) ([]byte, uint64) {
_ = b[7]
x := uint64(b[7]) | uint64(b[6])<<8 | uint64(b[shared.WordBuffers])<<16 | uint64(b[4])<<24 |
x := uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 |
uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56
return b[8:], x
}
@@ -126,21 +125,9 @@ func (d *digest) Reset() {
// implements encoding.BinaryMarshaler and encoding.BinaryUnmarshaler to
// marshal and unmarshal the internal state of the hash.
func New() hash.Hash {
d := new(digest)
d.blockFunc = block
var d digest
d.Reset()
return d
}
// NewGeneric is equivalent to New but uses the Go generic implementation,
// avoiding any processor-specific optimizations.
func NewGeneric() hash.Hash {
d := new(digest)
d.blockFunc = blockGeneric
d.Reset()
return d
return &d
}
func (d *digest) Size() int { return Size }
@@ -158,14 +145,14 @@ func (d *digest) Write(p []byte) (nn int, err error) {
n := copy(d.x[d.nx:], p)
d.nx += n
if d.nx == shared.Chunk {
d.blockFunc(d, d.x[:])
block(d, d.x[:])
d.nx = 0
}
p = p[n:]
}
if len(p) >= shared.Chunk {
n := len(p) &^ (shared.Chunk - 1)
d.blockFunc(d, p[:n])
block(d, p[:n])
p = p[n:]
}
if len(p) > 0 {
@@ -184,18 +171,20 @@ func (d *digest) Sum(in []byte) []byte {
func (d *digest) checkSum() [Size]byte {
len := d.len
// Padding. Add a 1 bit and 0 bits until 56 bytes mod 64.
var tmp [64]byte
var tmp [64 + 8]byte
tmp[0] = 0x80
var t uint64
if len%64 < 56 {
d.Write(tmp[0 : 56-len%64])
t = 56 - len%64
} else {
d.Write(tmp[0 : 64+56-len%64])
t = 64 + 56 - len%64
}
// Length in bits.
len <<= 3
binary.BigEndian.PutUint64(tmp[:], len)
d.Write(tmp[0:8])
padlen := tmp[:t+8]
binary.BigEndian.PutUint64(tmp[t:], len)
d.Write(padlen)
if d.nx != 0 {
panic("d.nx != 0")
@@ -214,7 +203,8 @@ func (d *digest) checkSum() [Size]byte {
// Sum returns the SHA-1 checksum of the data.
func Sum(data []byte) ([Size]byte, bool) {
d := New().(*digest)
var d digest
d.Reset()
d.Write(data)
return d.checkSum(), d.col
}