GenLockID generates a unique and consistent lock ID from a given string.
(name string)
| 20 | |
| 21 | // GenLockID generates a unique and consistent lock ID from a given string. |
| 22 | func GenLockID(name string) int64 { |
| 23 | hash := fnv.New64() |
| 24 | _, _ = hash.Write([]byte(name)) |
| 25 | // #nosec G115 - Safe conversion as FNV hash should be treated as random value and both uint64/int64 have the same range of unique values |
| 26 | return int64(hash.Sum64()) |
| 27 | } |