github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/internal/trace/v2/version/version.go (about) 1 // Copyright 2023 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 version 6 7 import ( 8 "github.com/shogo82148/std/io" 9 10 "github.com/shogo82148/std/internal/trace/v2/event" 11 ) 12 13 // Version represents the version of a trace file. 14 type Version uint32 15 16 const ( 17 Go111 Version = 11 18 Go119 Version = 19 19 Go121 Version = 21 20 Go122 Version = 22 21 Go123 Version = 23 22 Current = Go123 23 ) 24 25 // Specs returns the set of event.Specs for this version. 26 func (v Version) Specs() []event.Spec 27 28 func (v Version) Valid() bool 29 30 // ReadHeader reads the version of the trace out of the trace file's 31 // header, whose prefix must be present in v. 32 func ReadHeader(r io.Reader) (Version, error) 33 34 // WriteHeader writes a header for a trace version v to w. 35 func WriteHeader(w io.Writer, v Version) (int, error)