os: add File.Chown on the unix path

file_unix.go (darwin/linux/wasip) was missing the exported (*File).Chown method
that file_other.go (baremetal/wasm) already has, so callers requiring the full
os.File surface — e.g. github.com/pkg/sftp — failed to compile for the
linux/amd64 TinyGo target. Delegates to the package-level Chown, mirroring
(*File).Truncate.
This commit is contained in:
Moses Narrow
2026-07-16 09:01:30 -05:00
committed by Damian Gryski
parent 338af91ae6
commit ac45c35924
+11
View File
@@ -163,6 +163,17 @@ func (f *File) Truncate(size int64) (err error) {
return Truncate(f.name, size)
}
// Chown changes the numeric uid and gid of the named file.
// A uid or gid of -1 means to not change that value.
// If there is an error, it will be of type *PathError.
func (f *File) Chown(uid, gid int) error {
if f.handle == nil {
return ErrClosed
}
return Chown(f.name, uid, gid)
}
func (f *File) chmod(mode FileMode) error {
if f.handle == nil {
return ErrClosed