Commit 0ac8739a authored by Bryan C. Mills's avatar Bryan C. Mills

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent afac2c05
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment