Skip to content

Commit 3a412b2

Browse files
committed
add windows stub
Signed-off-by: leongross <[email protected]>
1 parent 1474639 commit 3a412b2

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/os/file_windows.go

+14
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ func Pipe() (r *File, w *File, err error) {
5959
return
6060
}
6161

62+
func (f *unixFileHandle) Truncate(size int64) error {
63+
return ErrNotImplemented
64+
}
65+
6266
func tempDir() string {
6367
n := uint32(syscall.MAX_PATH)
6468
for {
@@ -106,6 +110,16 @@ func (f unixFileHandle) Sync() error {
106110
return ErrNotImplemented
107111
}
108112

113+
func (f *File) Truncate(size int64) error {
114+
var err error
115+
if f.handle == nil {
116+
err = ErrClosed
117+
} else {
118+
err = ErrNotImplemented
119+
}
120+
return &PathError{Op: "truncate", Path: f.name, Err: err}
121+
}
122+
109123
// isWindowsNulName reports whether name is os.DevNull ('NUL') on Windows.
110124
// True is returned if name is 'NUL' whatever the case.
111125
func isWindowsNulName(name string) bool {

src/syscall/syscall_libc.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,6 @@ func libc_readlink(path *byte, buf *byte, count uint) int
451451
//export unlink
452452
func libc_unlink(pathname *byte) int32
453453

454-
<<<<<<< HEAD
455454
// pid_t fork(void);
456455
//
457456
//export fork
@@ -461,12 +460,11 @@ func libc_fork() int32
461460
//
462461
//export execve
463462
func libc_execve(filename *byte, argv **byte, envp **byte) int
464-
=======
463+
465464
// int truncate(const char *path, off_t length);
466465
//
467466
//export truncate
468467
func libc_truncate(path *byte, length int64) int32
469468

470469
//go:extern environ
471470
var libc_environ *unsafe.Pointer
472-
>>>>>>> 2bb9c18a (add file.Truncate)

0 commit comments

Comments
 (0)