// hasWritePerm reports whether the current user has permission to write to the // file with the given info. // // Although the root user on most Unix systems can write to files even without // permission, hasWritePerm reports false if no appropriate permission bit is // set even if the current user is root. func hasWritePerm(path string, fi fs.FileInfo) bool { … }