Skip to content

Commit a8e99ab

Browse files
cagedmantisgopherbot
authored andcommitted
internal/trace: expose the go version read by the reader
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 <[email protected]> Auto-Submit: Carlos Amedee <[email protected]> Reviewed-by: Michael Knyszek <[email protected]>
1 parent 68b51e9 commit a8e99ab

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2025 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package trace
6+
7+
import "internal/trace/version"
8+
9+
// GoVersion is the version set in the trace header.
10+
func (r *Reader) GoVersion() version.Version {
11+
return r.version
12+
}

src/internal/trace/reader_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"io"
1212
"os"
1313
"path/filepath"
14+
"runtime"
1415
"strings"
1516
"testing"
1617
"time"
@@ -109,6 +110,10 @@ func testReader(t *testing.T, tr io.Reader, v *testtrace.Validator, exp *testtra
109110
if err == io.EOF {
110111
break
111112
}
113+
v.GoVersion = r.GoVersion()
114+
if runtime.GOOS == "windows" || runtime.GOARCH == "wasm" {
115+
v.SkipClockSnapshotChecks()
116+
}
112117
if err != nil {
113118
if err := exp.Check(err); err != nil {
114119
t.Error(err)

0 commit comments

Comments
 (0)