github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/configs/configload/inode_freebsd.go (about) 1 // Copyright (c) HashiCorp, Inc. 2 // SPDX-License-Identifier: MPL-2.0 3 4 //go:build freebsd 5 // +build freebsd 6 7 package configload 8 9 import ( 10 "fmt" 11 "os" 12 "syscall" 13 ) 14 15 // lookup the inode of a file on posix systems 16 func inode(path string) (uint64, error) { 17 stat, err := os.Stat(path) 18 if err != nil { 19 return 0, err 20 } 21 if st, ok := stat.Sys().(*syscall.Stat_t); ok { 22 return uint64(st.Ino), nil 23 } 24 return 0, fmt.Errorf("could not determine file inode") 25 }