// Copyright 2023 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 versionimport ()// Version represents the version of a trace file.typeVersionuint32const (Go111Version = 11Go119Version = 19Go121Version = 21Go122Version = 22Go123Version = 23Current = Go123)var versions = map[Version][]event.Spec{// Go 1.11–1.21 use a different parser and are only set here for the sake of // Version.Valid.Go111: nil,Go119: nil,Go121: nil,Go122: go122.Specs(),// Go 1.23 adds backwards-incompatible events, but // traces produced by Go 1.22 are also always valid // Go 1.23 traces.Go123: go122.Specs(),}// Specs returns the set of event.Specs for this version.func ( Version) () []event.Spec {returnversions[]}func ( Version) () bool { , := versions[]return}// headerFmt is the format of the header of all Go execution traces.const headerFmt = "go 1.%d trace\x00\x00\x00"// ReadHeader reads the version of the trace out of the trace file's// header, whose prefix must be present in v.func ( io.Reader) (Version, error) {varVersion , := fmt.Fscanf(, headerFmt, &)if != nil {return , fmt.Errorf("bad file format: not a Go execution trace?") }if !.Valid() {return , fmt.Errorf("unknown or unsupported trace version go 1.%d", ) }return , nil}// WriteHeader writes a header for a trace version v to w.func ( io.Writer, Version) (int, error) {returnfmt.Fprintf(, headerFmt, )}
The pages are generated with Goldsv0.7.3. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.