Skip to content

Commit 9d971fc

Browse files
committed
osutil: remove Ftruncate
`*os.File` has `Truncate()` Signed-off-by: Akihiro Suda <[email protected]>
1 parent 9705b66 commit 9d971fc

File tree

3 files changed

+1
-10
lines changed

3 files changed

+1
-10
lines changed

pkg/nativeimgutil/nativeimgutil.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/lima-vm/go-qcow2reader"
1515
"github.com/lima-vm/go-qcow2reader/image/qcow2"
1616
"github.com/lima-vm/go-qcow2reader/image/raw"
17-
"github.com/lima-vm/lima/pkg/osutil"
1817
"github.com/lima-vm/lima/pkg/progressbar"
1918
"github.com/sirupsen/logrus"
2019
)
@@ -169,5 +168,5 @@ func MakeSparse(f *os.File, n int64) error {
169168
if _, err := f.Seek(n, io.SeekStart); err != nil {
170169
return err
171170
}
172-
return osutil.Ftruncate(int(f.Fd()), n)
171+
return f.Truncate(n)
173172
}

pkg/osutil/osutil_unix.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ func Dup2(oldfd, newfd int) (err error) {
1313
return unix.Dup2(oldfd, newfd)
1414
}
1515

16-
func Ftruncate(fd int, length int64) (err error) {
17-
return unix.Ftruncate(fd, length)
18-
}
19-
2016
func SignalName(sig os.Signal) string {
2117
return unix.SignalName(sig.(syscall.Signal))
2218
}

pkg/osutil/osutil_windows.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ func Dup2(oldfd int, newfd syscall.Handle) (err error) {
3838
return fmt.Errorf("unimplemented")
3939
}
4040

41-
func Ftruncate(_ int, _ int64) (err error) {
42-
return fmt.Errorf("unimplemented")
43-
}
44-
4541
func SignalName(sig os.Signal) string {
4642
switch sig {
4743
case syscall.SIGINT:

0 commit comments

Comments
 (0)