diff options
Diffstat (limited to 'utils/race_checker.go')
-rw-r--r-- | utils/race_checker.go | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/utils/race_checker.go b/utils/race_checker.go deleted file mode 100644 index cd5ed556..00000000 --- a/utils/race_checker.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build race - -package utils - -import ( - "crypto/sha512" - "fmt" - "runtime" -) - -func SetChecker(b []byte) { - if len(b) == 0 { - return - } - c := checkIfConst(b) - go c.isStillConst() - runtime.SetFinalizer(c, (*constSlice).isStillConst) -} - -type constSlice struct { - b []byte - checksum [64]byte -} - -func checkIfConst(b []byte) *constSlice { - c := &constSlice{b: b} - c.checksum = sha512.Sum512(c.b) - return c -} - -func (c *constSlice) isStillConst() { - if sha512.Sum512(c.b) != c.checksum { - panic(fmt.Sprintf("mutable access detected 0x%012x", &c.b[0])) - } -} |