mirror of
https://github.com/golang/go
synced 2024-09-30 02:14:29 -06:00
cmd/compile: gofmt -w -s
Change-Id: I4dad103d23121a21b04800ec157487fdf79f89a6 Reviewed-on: https://go-review.googlesource.com/c/go/+/424398 Run-TryBot: hopehook <hopehook@qq.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
9c2b481b57
commit
87d6a9ff92
@ -32,12 +32,15 @@ var hd HashDebug
|
||||
// DebugHashMatch reports whether environment variable GOSSAHASH
|
||||
//
|
||||
// 1. is empty (this is a special more-quickly implemented case of 3)
|
||||
//
|
||||
// 2. is "y" or "Y"
|
||||
//
|
||||
// 3. is a suffix of the sha1 hash of name
|
||||
//
|
||||
// 4. OR
|
||||
// if evname(i) is a suffix of the sha1 hash of name
|
||||
// where evname(i)=fmt.Sprintf("GOSSAHASH%d", i),
|
||||
// for 0<=i<n such that for all i evname(i) != "" and evname(n) == ""
|
||||
// if evname(i) is a suffix of the sha1 hash of name
|
||||
// where evname(i)=fmt.Sprintf("GOSSAHASH%d", i),
|
||||
// for 0<=i<n such that for all i evname(i) != "" and evname(n) == ""
|
||||
//
|
||||
// That is, as long as they're not empty, try GOSSAHASH, GOSSAHASH0, GOSSAHASH1, etc,
|
||||
// but quit trying at the first empty environment variable substitution.
|
||||
@ -55,27 +58,30 @@ var hd HashDebug
|
||||
// Typical use:
|
||||
//
|
||||
// 1. you make a change to the compiler, say, adding a new phase
|
||||
//
|
||||
// 2. it is broken in some mystifying way, for example, make.bash builds a broken
|
||||
// compiler that almost works, but crashes compiling a test in run.bash.
|
||||
//
|
||||
// 3. add this guard to the code, which by default leaves it broken, but
|
||||
// does not run the broken new code if GOSSAHASH is non-empty and non-matching:
|
||||
//
|
||||
// if !base.DebugHashMatch(ir.PkgFuncName(fn)) {
|
||||
// return nil // early exit, do nothing
|
||||
// }
|
||||
// if !base.DebugHashMatch(ir.PkgFuncName(fn)) {
|
||||
// return nil // early exit, do nothing
|
||||
// }
|
||||
//
|
||||
// 4. rebuild w/o the bad code, GOSSAHASH=n ./all.bash to verify that you
|
||||
// put theguard in the right place with the right sense of the test.
|
||||
//
|
||||
// 5. use github.com/dr2chase/gossahash to search for the error:
|
||||
//
|
||||
// go install github.com/dr2chase/gossahash@latest
|
||||
// go install github.com/dr2chase/gossahash@latest
|
||||
//
|
||||
// gossahash -- <the thing that fails>
|
||||
// gossahash -- <the thing that fails>
|
||||
//
|
||||
// for example: GOMAXPROCS=1 gossahash -- ./all.bash
|
||||
//
|
||||
// for example: GOMAXPROCS=1 gossahash -- ./all.bash
|
||||
// 6. gossahash should return a single function whose miscompilation
|
||||
// causes the problem, and you can focus on that.
|
||||
//
|
||||
func DebugHashMatch(pkgAndName string) bool {
|
||||
return hd.DebugHashMatch(pkgAndName)
|
||||
}
|
||||
|
@ -809,7 +809,9 @@ func (f *Func) invalidateCFG() {
|
||||
}
|
||||
|
||||
// DebugHashMatch returns
|
||||
// base.DebugHashMatch(this function's package.name)
|
||||
//
|
||||
// base.DebugHashMatch(this function's package.name)
|
||||
//
|
||||
// for use in bug isolation. The return value is true unless
|
||||
// environment variable GOSSAHASH is set, in which case "it depends".
|
||||
// See [base.DebugHashMatch] for more information.
|
||||
|
Loading…
Reference in New Issue
Block a user