From d144b116111aa5ab8b14672d0692cacae35ec80c Mon Sep 17 00:00:00 2001 From: deadprogram Date: Fri, 23 Aug 2024 12:44:39 +0200 Subject: [PATCH] fix: add missing Truncate() function stub to os/file for bare-metal systems Signed-off-by: deadprogram --- src/os/file_other.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/os/file_other.go b/src/os/file_other.go index d359b0fb67..977fcac12d 100644 --- a/src/os/file_other.go +++ b/src/os/file_other.go @@ -135,3 +135,17 @@ func Readlink(name string) (string, error) { func tempDir() string { return "/tmp" } + +// Truncate is unsupported on this system. +func Truncate(filename string, size int64) (err error) { + return ErrUnsupported +} + +// Truncate is unsupported on this system. +func (f *File) Truncate(size int64) (err error) { + if f.handle == nil { + return ErrClosed + } + + return Truncate(f.name, size) +}