func isSameFilesystem(rootStat, osStat os.FileInfo) bool {
	return rootStat.Sys().(*syscall.Stat_t).Dev == osStat.Sys().(*syscall.Stat_t).Dev
}
isSameFilesystem compares if two entries have the same root device number st_dev.
package main
import (
	"os"
	"syscall"
)