diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2017-03-17 17:09:07 -0700 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2017-03-24 22:21:55 +0000 |
commit | b3a8beb9d1eb7bd28b22e3a26f65c6025017d7a3 (patch) | |
tree | 6670573dea676a575ce373ebbe29e58b83eb9cba /src/cmd/compile/internal/ssa/func.go | |
parent | 26be4b9113e9c4f14399388652e961137658b6cb (diff) | |
download | go-b3a8beb9d1eb7bd28b22e3a26f65c6025017d7a3.tar.gz go-b3a8beb9d1eb7bd28b22e3a26f65c6025017d7a3.zip |
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>
Diffstat (limited to 'src/cmd/compile/internal/ssa/func.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/func.go | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/cmd/compile/internal/ssa/func.go b/src/cmd/compile/internal/ssa/func.go index d37540e180..17860957cf 100644 --- a/src/cmd/compile/internal/ssa/func.go +++ b/src/cmd/compile/internal/ssa/func.go @@ -551,14 +551,13 @@ func (f *Func) invalidateCFG() { // opening the file. func (f *Func) DebugHashMatch(evname, name string) bool { evhash := os.Getenv(evname) - if evhash == "" { + switch evhash { + case "": return true // default behavior with no EV is "on" - } - if evhash == "y" || evhash == "Y" { + case "y", "Y": f.logDebugHashMatch(evname, name) return true - } - if evhash == "n" || evhash == "N" { + case "n", "N": return false } // 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] if file == nil { file = os.Stdout - tmpfile := os.Getenv("GSHS_LOGFILE") - if tmpfile != "" { - var ok error - file, ok = os.Create(tmpfile) - if ok != nil { + if tmpfile := os.Getenv("GSHS_LOGFILE"); tmpfile != "" { + var err error + file, err = os.Create(tmpfile) + if err != nil { f.Fatalf("could not open hash-testing logfile %s", tmpfile) } } |