Skip to content

Commit d144b11

Browse files
committed
fix: add missing Truncate() function stub to os/file for bare-metal systems
Signed-off-by: deadprogram <[email protected]>
1 parent 1ef1aa7 commit d144b11

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/os/file_other.go

+14
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,17 @@ func Readlink(name string) (string, error) {
135135
func tempDir() string {
136136
return "/tmp"
137137
}
138+
139+
// Truncate is unsupported on this system.
140+
func Truncate(filename string, size int64) (err error) {
141+
return ErrUnsupported
142+
}
143+
144+
// Truncate is unsupported on this system.
145+
func (f *File) Truncate(size int64) (err error) {
146+
if f.handle == nil {
147+
return ErrClosed
148+
}
149+
150+
return Truncate(f.name, size)
151+
}

0 commit comments

Comments
 (0)