mirror of https://github.com/hashicorp/terraform
The syscall.Stat_t type doesn't exist on windows, so the inode lookup needs to be in a file with proper build constraints.pull/7298/head
parent
d39760e620
commit
525485c213
@ -0,0 +1,21 @@
|
||||
// +build !windows
|
||||
|
||||
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")
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package module
|
||||
|
||||
// no syscall.Stat_t on windows, return 0 for inodes
|
||||
func inode(path string) (uint64, error) {
|
||||
return 0, nil
|
||||
}
|
||||
Loading…
Reference in new issue