Files
magpie/internal/usage/log_file.go
T
Snowyy 3d8c6f24c5 usage: capture Windows change time for cached logs (#594)
* usage: capture Windows change time for cached logs

* ci: show native Windows usage test outcomes
2026-10-03 01:15:29 +08:00

21 lines
464 B
Go

package usage
import "os"
// Keep native file identity alongside a change time captured from the same
// handle. os.SameFile requires the original os.FileInfo, not this wrapper.
type logFileInfo struct {
os.FileInfo
stamp string
}
func sameLogFile(a, b os.FileInfo) bool {
if wrapped, ok := a.(logFileInfo); ok {
a = wrapped.FileInfo
}
if wrapped, ok := b.(logFileInfo); ok {
b = wrapped.FileInfo
}
return a != nil && b != nil && os.SameFile(a, b)
}