I am working on a file manager for 9front/Plan9; dev work is done in Go v1.15 under 64-bit Ubuntu with cross-compilation to build Plan9 binaries.
Let's assume a function to retrieve user/group information:
import "syscall"
func GetXid(info os.FileInfo) (string, string) {
UID := "N/A"
GID := "N/A"
if stat, ok := info.Sys().(*syscall.Stat_t); ok {
UID = strconv.Itoa(int(stat.Uid))
GID = strconv.Itoa(int(stat.Gid))
}
return UID, GID
}
it fails during Plan9 compilation with undefined: syscall.Stat_t
.
syscall
package page states that it has been deprecated since Go v1.4 and replaced with OS-specific repos under golang.org/x/sys/
.
- How to implement OS-specific casting of the
os.FileInfo.Sys
for Linux and Plan9