-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
code: Add proper build constraints for GH-7273
- Loading branch information
Showing
3 changed files
with
37 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |