Skip to content

Commit

Permalink
Revert "Remove uneeded type conversion"
Browse files Browse the repository at this point in the history
This reverts commit efcf97d. At 32bit platforms (e.g. armv6h)
it causes a compile time error:
  ./purge.go:43:31: cannot use atimeUnix.Sec (type int32) as type int64 in argument to time.Unix
  ./purge.go:43:46: cannot use atimeUnix.Nsec (type int32) as type int64 in argument to time.Unix

Closes anatol#18
  • Loading branch information
anatol committed Sep 2, 2020
1 parent efcf97d commit 6ac0efc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ func purgeStaleFiles(cacheDir string, purgeFilesAfter int) {
}

atimeUnix := info.Sys().(*syscall.Stat_t).Atim
atime := time.Unix(atimeUnix.Sec, atimeUnix.Nsec)
// Note that int64() is needed here, otherwise compilation fails at 32 bit platforms like armv6h. See issue #18.
atime := time.Unix(int64(atimeUnix.Sec), int64(atimeUnix.Nsec))
if atime.Before(removeIfOlder) {
log.Printf("Remove stale file %v as its access time (%v) is too old", path, atime)
err := os.Remove(path)
Expand Down

0 comments on commit 6ac0efc

Please sign in to comment.