mirror of
https://github.com/golang/go
synced 2024-09-29 16:24:28 -06:00
cmd/fix: eliminate data races in TestRewrite and gofmt
Fixes #35632 Change-Id: I55c3d53c2a6240868ec001866047a15ec8f91809 Reviewed-on: https://go-review.googlesource.com/c/go/+/207603 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
afac2c0508
commit
0ac8739ad5
@ -203,10 +203,8 @@ func processFile(filename string, useStdin bool) error {
|
||||
return ioutil.WriteFile(f.Name(), newSrc, 0)
|
||||
}
|
||||
|
||||
var gofmtBuf bytes.Buffer
|
||||
|
||||
func gofmt(n interface{}) string {
|
||||
gofmtBuf.Reset()
|
||||
var gofmtBuf bytes.Buffer
|
||||
if err := format.Node(&gofmtBuf, fset, n); err != nil {
|
||||
return "<" + err.Error() + ">"
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ func parseFixPrint(t *testing.T, fn func(*ast.File) bool, desc, in string, mustB
|
||||
|
||||
func TestRewrite(t *testing.T) {
|
||||
for _, tt := range testCases {
|
||||
tt := tt
|
||||
t.Run(tt.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Apply fix: should get tt.Out.
|
||||
|
Loading…
Reference in New Issue
Block a user