os.Stat()
returns a FileInfo object, which has a Sys()
method that returns an Interface{}
with no methods.
Though I am able to
The reflect module showed that the data type for Sys()
's return is *syscall.Stat_t
, so this seems to work to get the Gid of a file as a string:
file_info, _ := os.Stat(abspath)
file_sys := file_info.Sys()
file_gid := fmt.Sprint(file_sys.(*syscall.Stat_t).Gid)
Please let me know if there is a better way to do this.