aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-11-01 12:33:59 -0700
committerGopher Robot <gobot@golang.org>2022-11-10 18:51:20 +0000
commit79d9b395adf90f186617ee37800a18af0a7095ef (patch)
tree457be28ddf6ac4a92402a0fef146313bdebd83c8 /src/runtime/runtime.go
parentfbf763fd1d6be3c162ea5ff3c8843171ef937c3a (diff)
downloadgo-79d9b395adf90f186617ee37800a18af0a7095ef.tar.xz
runtime: consolidate some low-level error reporting
Use a single writeErrStr function. Avoid using global variables. Use a single version of some error messages rather than duplicating the messages in OS-specific files. Change-Id: If259fbe78faf797f0a21337d14472160ca03efa0 Reviewed-on: https://go-review.googlesource.com/c/go/+/447055 Run-TryBot: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/runtime.go')
-rw-r--r--src/runtime/runtime.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/runtime/runtime.go b/src/runtime/runtime.go
index 25b714de4e..bc60b3ca75 100644
--- a/src/runtime/runtime.go
+++ b/src/runtime/runtime.go
@@ -6,7 +6,7 @@ package runtime
import (
"runtime/internal/atomic"
- _ "unsafe" // for go:linkname
+ "unsafe"
)
//go:generate go run wincallback.go
@@ -93,3 +93,10 @@ func syscall_runtimeUnsetenv(key string) {
godebugenv.Store(nil)
}
}
+
+// writeErrStr writes a string to descriptor 2.
+//
+//go:nosplit
+func writeErrStr(s string) {
+ write(2, unsafe.Pointer(unsafe.StringData(s)), int32(len(s)))
+}