mirror of
https://github.com/golang/go
synced 2024-11-22 14:44:50 -07:00
cmd/go/internal/cache: use internal/godebug for three GODEBUGs
And register/document them. Change-Id: If0f1cf3c09230e0f63d03c52e56e51a030468ab2 Reviewed-on: https://go-review.googlesource.com/c/go/+/487655 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
parent
c5ba9d2232
commit
9b41418074
@ -182,6 +182,12 @@ Go 1.18 removed support for SHA1 in most X.509 certificates,
|
||||
controlled by the [`x509sha1` setting](/crypto/x509#InsecureAlgorithmError).
|
||||
This setting will be removed in a future release, Go 1.22 at the earliest.
|
||||
|
||||
### Go 1.10
|
||||
|
||||
Go 1.10 changed how build caching worked and added test caching, along
|
||||
with the [`gocacheverify`, `gocachehash`, and `gocachetest` settings](/cmd/go/#hdr-Build_and_test_caching).
|
||||
There is no plan to remove these settings.
|
||||
|
||||
### Go 1.6
|
||||
|
||||
Go 1.6 introduced transparent support for HTTP/2,
|
||||
|
31
src/cmd/go/internal/cache/cache.go
vendored
31
src/cmd/go/internal/cache/cache.go
vendored
@ -11,6 +11,7 @@ import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"internal/godebug"
|
||||
"io"
|
||||
"io/fs"
|
||||
"os"
|
||||
@ -115,20 +116,24 @@ var DebugTest = false
|
||||
|
||||
func init() { initEnv() }
|
||||
|
||||
var (
|
||||
goCacheVerify = godebug.New("gocacheverify")
|
||||
goDebugHash = godebug.New("gocachehash")
|
||||
goCacheTest = godebug.New("gocachetest")
|
||||
)
|
||||
|
||||
func initEnv() {
|
||||
verify = false
|
||||
debugHash = false
|
||||
debug := strings.Split(os.Getenv("GODEBUG"), ",")
|
||||
for _, f := range debug {
|
||||
if f == "gocacheverify=1" {
|
||||
verify = true
|
||||
}
|
||||
if f == "gocachehash=1" {
|
||||
debugHash = true
|
||||
}
|
||||
if f == "gocachetest=1" {
|
||||
DebugTest = true
|
||||
}
|
||||
if goCacheVerify.Value() == "1" {
|
||||
goCacheVerify.IncNonDefault()
|
||||
verify = true
|
||||
}
|
||||
if goDebugHash.Value() == "1" {
|
||||
goDebugHash.IncNonDefault()
|
||||
debugHash = true
|
||||
}
|
||||
if goCacheTest.Value() == "1" {
|
||||
goCacheTest.IncNonDefault()
|
||||
DebugTest = true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,9 @@ type Info struct {
|
||||
// (Otherwise the test in this package will fail.)
|
||||
var All = []Info{
|
||||
{Name: "execerrdot", Package: "os/exec"},
|
||||
{Name: "gocachehash", Package: "cmd/go"},
|
||||
{Name: "gocachetest", Package: "cmd/go"},
|
||||
{Name: "gocacheverify", Package: "cmd/go"},
|
||||
{Name: "http2client", Package: "net/http"},
|
||||
{Name: "http2debug", Package: "net/http", Opaque: true},
|
||||
{Name: "http2server", Package: "net/http"},
|
||||
|
@ -234,6 +234,18 @@ Below is the full list of supported metrics, ordered lexicographically.
|
||||
The number of non-default behaviors executed by the os/exec
|
||||
package due to a non-default GODEBUG=execerrdot=... setting.
|
||||
|
||||
/godebug/non-default-behavior/gocachehash:events
|
||||
The number of non-default behaviors executed by the cmd/go
|
||||
package due to a non-default GODEBUG=gocachehash=... setting.
|
||||
|
||||
/godebug/non-default-behavior/gocachetest:events
|
||||
The number of non-default behaviors executed by the cmd/go
|
||||
package due to a non-default GODEBUG=gocachetest=... setting.
|
||||
|
||||
/godebug/non-default-behavior/gocacheverify:events
|
||||
The number of non-default behaviors executed by the cmd/go
|
||||
package due to a non-default GODEBUG=gocacheverify=... setting.
|
||||
|
||||
/godebug/non-default-behavior/http2client:events
|
||||
The number of non-default behaviors executed by the net/http
|
||||
package due to a non-default GODEBUG=http2client=... setting.
|
||||
|
Loading…
Reference in New Issue
Block a user