//go:build unix package config import ( "io/fs" "syscall" ) // inodeOf reports the inode of a file, or 0 when the platform does not expose one. // // A rename over the config — which is how every legitimate change is written — changes the inode, so // this is what makes "the file was replaced" detectable even when the modification time and size // happen to match, as they do when a pairing is immediately followed by a destroy. func inodeOf(info fs.FileInfo) uint64 { stat, ok := info.Sys().(*syscall.Stat_t) if !ok { return 0 } return uint64(stat.Ino) }