From 44cf64512306b88644cf8fb6fd6eef1c866e7778 Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Wed, 17 Jul 2024 18:09:13 -0700 Subject: [PATCH] more explanations of --- goroutine/gid_tinygo.go | 2 ++ logger_test.go | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/goroutine/gid_tinygo.go b/goroutine/gid_tinygo.go index 8b053bb..883c111 100644 --- a/goroutine/gid_tinygo.go +++ b/goroutine/gid_tinygo.go @@ -33,5 +33,7 @@ func ID() int64 { //return int64(uintptr(currentTask())) } +// Call https://github.com/tinygo-org/tinygo/blob/v0.32.0/src/internal/task/task_stack.go#L39 +// //go:linkname currentTask internal/task.Current func currentTask() unsafe.Pointer diff --git a/logger_test.go b/logger_test.go index dfc10ae..7941410 100644 --- a/logger_test.go +++ b/logger_test.go @@ -944,8 +944,12 @@ func TestInvalidFile(t *testing.T) { } } -// like io.Discard except io.Discard is checked for by logger optimizations and we want to avoid that. -// e.g. https://cs.opensource.google/go/go/+/refs/tags/go1.22.5:src/log/log.go;l=84 +// --- Benchmarks + +// This `discard` is like io.Discard, except that io.Discard is checked explicitly +// (e.g. https://cs.opensource.google/go/go/+/refs/tags/go1.22.5:src/log/log.go;l=84) +// in logger optimizations and we want to measure the actual production +// of messages. type discard struct{} func (discard) Write(p []byte) (int, error) {