Skip to content

Commit 8ca273a

Browse files
committed
src/os: export correct values for os.DevNull for each OS
This commit introduces `os.DevNull` exports for all supported OS targets.
1 parent 7e647a5 commit 8ca273a

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

src/os/file_anyos.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ var (
2626
Stderr = NewFile(uintptr(syscall.Stderr), "/dev/stderr")
2727
)
2828

29-
const DevNull = "/dev/null"
30-
3129
// isOS indicates whether we're running on a real operating system with
3230
// filesystem support.
3331
const isOS = true

src/os/file_other.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ var (
1515
Stderr = NewFile(2, "/dev/stderr")
1616
)
1717

18+
const DevNull = "/dev/null"
19+
1820
// isOS indicates whether we're running on a real operating system with
1921
// filesystem support.
2022
const isOS = false

src/os/file_unix.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
//go:build darwin || (linux && !baremetal)
22
// +build darwin linux,!baremetal
33

4+
// target wasi sets GOOS=linux and thus the +linux build tag,
5+
// even though it doesn't show up in "tinygo info target -wasi
6+
47
// Portions copyright 2009 The Go Authors. All rights reserved.
58
// Use of this source code is governed by a BSD-style
69
// license that can be found in the LICENSE file.
@@ -12,6 +15,8 @@ import (
1215
"syscall"
1316
)
1417

18+
const DevNull = "/dev/null"
19+
1520
type syscallFd = int
1621

1722
// fixLongPath is a noop on non-Windows platforms.

src/os/file_windows.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
"unicode/utf16"
1414
)
1515

16+
const DevNull = "NUL"
17+
1618
type syscallFd = syscall.Handle
1719

1820
// Symlink is a stub, it is not implemented.

0 commit comments

Comments
 (0)