syscall: define no-op Errno type on plan9

Go's api/go1.txt's has line "pkg syscall, type Errno uintptr",
suggesting people should assume this type always exists. It does
for GOOS=js GOARCH=wasm too, which was also added later.

Adding this here lets portable code be written without build-tagged
files, using runtime.GOOS checks instead.

Change-Id: I785a19ec104d2ac34b55a96b5a342bcc33712961
Reviewed-on: https://go-review.googlesource.com/c/go/+/750680
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Brad Fitzpatrick
2026-03-02 09:40:12 -08:00
parent 033b11f257
commit b5c2bd7e05

View File

@@ -21,6 +21,15 @@ import (
const ImplementsGetwd = true
const bitSize16 = 2
// Errno is not used with GOOS plan9.
//
// It exists because because the Go 1 API contract
// (api/go1.txt's "pkg syscall, type Errno uintptr")
// says it exists, and so code in the ecosystem often
// assume it exists. This lets portable code be written
// without build-tagged files, using runtime.GOOS checks instead.
type Errno uintptr
// ErrorString implements Error's String method by returning itself.
//
// ErrorString values can be tested against error values using [errors.Is].