diff --git a/internal/sysfs/osfile.go b/internal/sysfs/osfile.go index 490f0fa681..1930f3c796 100644 --- a/internal/sysfs/osfile.go +++ b/internal/sysfs/osfile.go @@ -254,7 +254,7 @@ func (f *osFile) Pwrite(buf []byte, off int64) (n int, errno experimentalsys.Err // Truncate implements the same method as documented on sys.File func (f *osFile) Truncate(size int64) (errno experimentalsys.Errno) { - if errno = experimentalsys.UnwrapOSError(f.file.Truncate(size)); errno != 0 { + if errno = experimentalsys.UnwrapOSError(truncate(f.file, size)); errno != 0 { // Defer validation overhead until we've already had an error. errno = fileError(f, f.closed, errno) } diff --git a/internal/sysfs/truncate.go b/internal/sysfs/truncate.go new file mode 100644 index 0000000000..44a27202b1 --- /dev/null +++ b/internal/sysfs/truncate.go @@ -0,0 +1,9 @@ +//go:build !tinygo + +package sysfs + +import "os" + +func truncate(file *os.File, size int64) error { + return file.Truncate(size) +} diff --git a/internal/sysfs/truncate_tinygo.go b/internal/sysfs/truncate_tinygo.go new file mode 100644 index 0000000000..1bd36f9a54 --- /dev/null +++ b/internal/sysfs/truncate_tinygo.go @@ -0,0 +1,9 @@ +//go:build tinygo + +package sysfs + +import "os" + +func truncate(file *os.File, size int64) error { + return nil +}