mirror of
https://github.com/golang/go
synced 2024-09-30 09:38:38 -06:00
cmd/compile: minor cleanup in debug code
Change-Id: I9885606801b9c8fcb62c16d0856025c4e83e658b Reviewed-on: https://go-review.googlesource.com/38650 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
26be4b9113
commit
b3a8beb9d1
@ -551,14 +551,13 @@ func (f *Func) invalidateCFG() {
|
|||||||
// opening the file.
|
// opening the file.
|
||||||
func (f *Func) DebugHashMatch(evname, name string) bool {
|
func (f *Func) DebugHashMatch(evname, name string) bool {
|
||||||
evhash := os.Getenv(evname)
|
evhash := os.Getenv(evname)
|
||||||
if evhash == "" {
|
switch evhash {
|
||||||
|
case "":
|
||||||
return true // default behavior with no EV is "on"
|
return true // default behavior with no EV is "on"
|
||||||
}
|
case "y", "Y":
|
||||||
if evhash == "y" || evhash == "Y" {
|
|
||||||
f.logDebugHashMatch(evname, name)
|
f.logDebugHashMatch(evname, name)
|
||||||
return true
|
return true
|
||||||
}
|
case "n", "N":
|
||||||
if evhash == "n" || evhash == "N" {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// Check the hash of the name against a partial input hash.
|
// Check the hash of the name against a partial input hash.
|
||||||
@ -597,11 +596,10 @@ func (f *Func) logDebugHashMatch(evname, name string) {
|
|||||||
file := f.logfiles[evname]
|
file := f.logfiles[evname]
|
||||||
if file == nil {
|
if file == nil {
|
||||||
file = os.Stdout
|
file = os.Stdout
|
||||||
tmpfile := os.Getenv("GSHS_LOGFILE")
|
if tmpfile := os.Getenv("GSHS_LOGFILE"); tmpfile != "" {
|
||||||
if tmpfile != "" {
|
var err error
|
||||||
var ok error
|
file, err = os.Create(tmpfile)
|
||||||
file, ok = os.Create(tmpfile)
|
if err != nil {
|
||||||
if ok != nil {
|
|
||||||
f.Fatalf("could not open hash-testing logfile %s", tmpfile)
|
f.Fatalf("could not open hash-testing logfile %s", tmpfile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user