github.com/ice-blockchain/go/src@v0.0.0-20240403114104-1564d284e521/internal/godebugs/table.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 godebugs provides a table of known GODEBUG settings, 6 // for use by a variety of other packages, including internal/godebug, 7 // runtime, runtime/metrics, and cmd/go/internal/load. 8 package godebugs 9 10 // An Info describes a single known GODEBUG setting. 11 type Info struct { 12 Name string // name of the setting ("panicnil") 13 Package string // package that uses the setting ("runtime") 14 Changed int // minor version when default changed, if any; 21 means Go 1.21 15 Old string // value that restores behavior prior to Changed 16 Opaque bool // setting does not export information to runtime/metrics using [internal/godebug.Setting.IncNonDefault] 17 } 18 19 // All is the table of known settings, sorted by Name. 20 // 21 // Note: After adding entries to this table, run 'go generate runtime/metrics' 22 // to update the runtime/metrics doc comment. 23 // (Otherwise the runtime/metrics test will fail.) 24 // 25 // Note: After adding entries to this table, update the list in doc/godebug.md as well. 26 // (Otherwise the test in this package will fail.) 27 var All = []Info{ 28 {Name: "asynctimerchan", Package: "time", Changed: 23, Old: "1", Opaque: true}, 29 {Name: "execerrdot", Package: "os/exec"}, 30 {Name: "gocachehash", Package: "cmd/go"}, 31 {Name: "gocachetest", Package: "cmd/go"}, 32 {Name: "gocacheverify", Package: "cmd/go"}, 33 {Name: "gotypesalias", Package: "go/types", Opaque: true}, // bug #66216: remove Opaque 34 {Name: "http2client", Package: "net/http"}, 35 {Name: "http2debug", Package: "net/http", Opaque: true}, 36 {Name: "http2server", Package: "net/http"}, 37 {Name: "httplaxcontentlength", Package: "net/http", Changed: 22, Old: "1"}, 38 {Name: "httpmuxgo121", Package: "net/http", Changed: 22, Old: "1"}, 39 {Name: "installgoroot", Package: "go/build"}, 40 {Name: "jstmpllitinterp", Package: "html/template", Opaque: true}, // bug #66217: remove Opaque 41 //{Name: "multipartfiles", Package: "mime/multipart"}, 42 {Name: "multipartmaxheaders", Package: "mime/multipart"}, 43 {Name: "multipartmaxparts", Package: "mime/multipart"}, 44 {Name: "multipathtcp", Package: "net"}, 45 {Name: "netdns", Package: "net", Opaque: true}, 46 {Name: "panicnil", Package: "runtime", Changed: 21, Old: "1"}, 47 {Name: "randautoseed", Package: "math/rand"}, 48 {Name: "tarinsecurepath", Package: "archive/tar"}, 49 {Name: "tls10server", Package: "crypto/tls", Changed: 22, Old: "1"}, 50 {Name: "tlsmaxrsasize", Package: "crypto/tls"}, 51 {Name: "tlsrsakex", Package: "crypto/tls", Changed: 22, Old: "1"}, 52 {Name: "tlsunsafeekm", Package: "crypto/tls", Changed: 22, Old: "1"}, 53 {Name: "winreadlinkvolume", Package: "os", Changed: 22, Old: "0"}, 54 {Name: "winsymlink", Package: "os", Changed: 22, Old: "0"}, 55 {Name: "x509sha1", Package: "crypto/x509"}, 56 {Name: "x509usefallbackroots", Package: "crypto/x509"}, 57 {Name: "x509usepolicies", Package: "crypto/x509"}, 58 {Name: "zipinsecurepath", Package: "archive/zip"}, 59 } 60 61 // Lookup returns the Info with the given name. 62 func Lookup(name string) *Info { 63 // binary search, avoiding import of sort. 64 lo := 0 65 hi := len(All) 66 for lo < hi { 67 m := int(uint(lo+hi) >> 1) 68 mid := All[m].Name 69 if name == mid { 70 return &All[m] 71 } 72 if name < mid { 73 hi = m 74 } else { 75 lo = m + 1 76 } 77 } 78 return nil 79 }