This change adds a function to expose the version set by the trace
reader after reading the trace header (in tests). The trace validator
needs to be able to determine what version of the trace it needs to
validate against. Clock snapshot checks have been disabled for
Windows and WASM.
For #63185
Change-Id: Ia3d63e6ed7a5ecd87e63292b84cc417d982aaa5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/677695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
--- /dev/null
+// Copyright 2025 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package trace
+
+import "internal/trace/version"
+
+// GoVersion is the version set in the trace header.
+func (r *Reader) GoVersion() version.Version {
+ return r.version
+}
"io"
"os"
"path/filepath"
+ "runtime"
"strings"
"testing"
"time"
if err == io.EOF {
break
}
+ v.GoVersion = r.GoVersion()
+ if runtime.GOOS == "windows" || runtime.GOARCH == "wasm" {
+ v.SkipClockSnapshotChecks()
+ }
if err != nil {
if err := exp.Check(err); err != nil {
t.Error(err)