// Copyright 2022 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 cpuimport// parseRelease parses a dot-separated version number from the prefix// of rel. It returns ok=true only if at least the major and minor// components were successfully parsed; the patch component is// best-effort. Trailing vendor or build suffixes such as// "-generic", "+", "_hi3535", or "-rc1" are ignored.//// This is a copy of the Go runtime's parseRelease from// https://golang.org/cl/209597, updated in https://golang.org/cl/781800.func ( string) (, , int, bool) {// next consumes a run of decimal digits from the front of rel, // returning the parsed value. If the digits are followed by a // '.', it is consumed and more is set so the caller knows to // parse another component; otherwise scanning terminates and // the rest of rel is discarded. := func() ( int, , bool) { := 0for < len() && [] >= '0' && [] <= '9' { ++ }if == 0 {return0, false, false } , := strconv.Atoi([:])if != nil {return0, false, false }if < len() && [] == '.' { = [+1:]return , true, true } = ""return , false, true }varboolif , , = (); ! || ! {return0, 0, 0, false }if , , = (); ! {return0, 0, 0, false }if ! {return , , 0, true } , _, _ = ()return , , , true}
The pages are generated with Goldsv0.8.4. (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.