kubeform.dev/terraform-backend-sdk@v0.0.0-20220310143633-45f07fe731c5/configs/configload/inode_freebsd.go (about)

     1  //go:build freebsd
     2  // +build freebsd
     3  
     4  package configload
     5  
     6  import (
     7  	"fmt"
     8  	"os"
     9  	"syscall"
    10  )
    11  
    12  // lookup the inode of a file on posix systems
    13  func inode(path string) (uint64, error) {
    14  	stat, err := os.Stat(path)
    15  	if err != nil {
    16  		return 0, err
    17  	}
    18  	if st, ok := stat.Sys().(*syscall.Stat_t); ok {
    19  		return uint64(st.Ino), nil
    20  	}
    21  	return 0, fmt.Errorf("could not determine file inode")
    22  }