mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-04 13:17:43 -06:00
128f4d19e1
DragonFlyBSD is not officially supported, but allowing it to work is straightforward at the moment so we'll allow it for now.
22 lines
393 B
Go
22 lines
393 B
Go
// +build linux darwin openbsd netbsd solaris dragonfly
|
|
|
|
package module
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"syscall"
|
|
)
|
|
|
|
// lookup the inode of a file on posix systems
|
|
func inode(path string) (uint64, error) {
|
|
stat, err := os.Stat(path)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
if st, ok := stat.Sys().(*syscall.Stat_t); ok {
|
|
return st.Ino, nil
|
|
}
|
|
return 0, fmt.Errorf("could not determine file inode")
|
|
}
|