中的答案IsExecOwner(file string)
https://stackoverflow.com/a/60128480/293195解决了这个主题,但我不确定这是否等同于POSIXShell中的test -x
?如果用户在该文件的组中,并且该组设置了可执行位,则此解决方案可能不正确。
我需要咨询吗https://godoc.org/golang.org/x/sys/unix
这是
func Access(path string, mode uint32) (err error)
在https://godoc.org/golang.org/x/sys/unix#Accessmode := X_OK
参考:https://linux.die.net/man/2/access