mirror of https://github.com/hashicorp/terraform
Replace custom inode-based file comparison with os.SameFile. (#36562)
Remove inode.go, inode_freebsd.go, and inode_windows.go, eliminating platform-specific inode lookup logic. Replace sameFile function with os.SameFile, simplifying file comparison logic.pull/36571/head
parent
ea140f6dc8
commit
c3b339e69a
@ -1,25 +0,0 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
//go:build linux || darwin || openbsd || netbsd || solaris || dragonfly
|
||||
// +build linux darwin openbsd netbsd solaris dragonfly
|
||||
|
||||
package configload
|
||||
|
||||
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")
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
//go:build freebsd
|
||||
// +build freebsd
|
||||
|
||||
package configload
|
||||
|
||||
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 uint64(st.Ino), nil
|
||||
}
|
||||
return 0, fmt.Errorf("could not determine file inode")
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package configload
|
||||
|
||||
// no syscall.Stat_t on windows, return 0 for inodes
|
||||
func inode(path string) (uint64, error) {
|
||||
return 0, nil
|
||||
}
|
||||
Loading…
Reference in new issue