mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
cmd/compile: normalize whitespace around square brackets
I noticed some instances of "[ " and " ]" in the rewrite rules. Normalizing them helps catch possible future duplicate rules. Change-Id: I892fd7e9b4019ed304f0a61fa2bb7f7e47ef8f38 Reviewed-on: https://go-review.googlesource.com/c/go/+/213682 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
f53f987ebf
commit
4084c125cc
|
@ -1442,6 +1442,8 @@ func normalizeWhitespace(x string) string {
|
|||
x = strings.Join(strings.Fields(x), " ")
|
||||
x = strings.Replace(x, "( ", "(", -1)
|
||||
x = strings.Replace(x, " )", ")", -1)
|
||||
x = strings.Replace(x, "[ ", "[", -1)
|
||||
x = strings.Replace(x, " ]", "]", -1)
|
||||
x = strings.Replace(x, ")->", ") ->", -1)
|
||||
return x
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue