If a hash match is "disabled" (!enabled) indicate that in the
output with DISABLED. This is helpful in ensuring that multiple
package-directed command-line flags have the intended behavior,
e.g.
```
go build -a \
-gcflags=all=-d=gossahash=vn \
-gcflags=runtime=-d=gossahash=vy \
std
```
Output looks like
[DISABLED] [bisect-match 0x11d0ee166d9d61b4]
or (w/ "v"-prefixed hashcode )
sort/slice.go:23:29 note [DISABLED] [bisect-match 0xa5252e1c1b85f2ec]
gossahash triggered sort/slice.go:23:29 note [DISABLED]
100001011111001011101100
Change-Id: I797e02b3132f9781d97bacd0dcd2e80af0035cd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/497216
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
// change is selected.
func (d *HashDebug) matchAndLog(hash uint64, text, note func() string) bool {
if d.bisect != nil {
+ enabled := d.bisect.ShouldEnable(hash)
if d.bisect.ShouldPrint(hash) {
+ disabled := ""
+ if !enabled {
+ disabled = " [DISABLED]"
+ }
var t string
if !d.bisect.MarkerOnly() {
t = text()
if note != nil {
if n := note(); n != "" {
- t += ": " + n
+ t += ": " + n + disabled
+ disabled = ""
}
}
}
- d.log(d.name, hash, t)
+ d.log(d.name, hash, strings.TrimSpace(t+disabled))
}
- return d.bisect.ShouldEnable(hash)
+ return enabled
}
// TODO: Delete rest of function body when we switch to bisect-only.
if check {
t.Errorf("GOSSAHASH=n should NOT have matched for 'bar', '0'")
}
- wantPrefix(t, msg, "bar.0 [bisect-match ")
- wantContains(t, msg, "\nGOSSAHASH triggered bar.0 010100100011100101011110")
+ wantPrefix(t, msg, "bar.0 [DISABLED] [bisect-match ")
+ wantContains(t, msg, "\nGOSSAHASH triggered bar.0 [DISABLED] 010100100011100101011110")
}
func TestHashNoMatch(t *testing.T) {