mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
Alerting: Use unsafe.Slice for hashing a string during rule fingerprint calculation (#71000)
This commit is contained in:
parent
0817ee00f9
commit
ada325de2a
@ -263,12 +263,8 @@ func (r ruleWithFolder) Fingerprint() fingerprint {
|
|||||||
writeBytes(nil)
|
writeBytes(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// TODO fix it when upgraded to in GO1.20 to
|
|
||||||
/*
|
|
||||||
writeBytes(unsafe.Slice(unsafe.StringData(s), len(s))) //nolint:gosec
|
|
||||||
*/
|
|
||||||
// avoid allocation when converting string to byte slice
|
// avoid allocation when converting string to byte slice
|
||||||
writeBytes(*(*[]byte)(unsafe.Pointer(&s))) //nolint:gosec
|
writeBytes(unsafe.Slice(unsafe.StringData(s), len(s)))
|
||||||
}
|
}
|
||||||
// this temp slice is used to convert ints to bytes.
|
// this temp slice is used to convert ints to bytes.
|
||||||
tmp := make([]byte, 8)
|
tmp := make([]byte, 8)
|
||||||
|
Loading…
Reference in New Issue
Block a user