This is a fork of @stackus's errors. I'll be maintaining this version for my own use.
go get -u github.com/htquangg/aerrors
Go 1.22
▶ go test ./... -test.run=NONE -test.bench=. -test.benchmem
goos: darwin
goarch: arm64
pkg: github.com/htquangg/aerrors
BenchmarkInternalWithStack-8 1673311 685.7 ns/op 1536 B/op 11 allocs/op
BenchmarkInternalWithoutStack-8 144404904 8.213 ns/op 0 B/op 0 allocs/op
BenchmarkInternaEmptylWithStack-8 1567843 757.4 ns/op 1536 B/op 11 allocs/op
BenchmarkInternalEmptyWithoutStack-8 252769448 4.510 ns/op 0 B/op 0 allocs/op
BenchmarkNewEmptyWithStack-8 1701417 709.9 ns/op 1536 B/op 11 allocs/op
BenchmarkNewEmptylWithoutStack-8 266327073 4.640 ns/op 0 B/op 0 allocs/op
BenchmarkNewWithStack-8 1658805 718.7 ns/op 1536 B/op 11 allocs/op
BenchmarkNewlWithoutStack-8 117173900 9.539 ns/op 0 B/op 0 allocs/op
Based off work in:
Dont be a shitty human being and make your own solution.