Skip to content

Commit c160d36

Browse files
committed
Stop messing with whitespace
1 parent a62fd5a commit c160d36

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/flakeguard/golang/golang.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,10 @@ func SkipTests(repoPath string, testsToSkip []*SkipTest) error {
291291

292292
// Write back the file
293293
var out strings.Builder
294-
if err := printer.Fprint(&out, fset, fileAst); err != nil {
294+
customPrint := printer.Config{
295+
Mode: printer.RawFormat, // Stop go from messing with whitespace when printing out the file (messes with git diff, not the place to do this)
296+
}
297+
if err := customPrint.Fprint(&out, fset, fileAst); err != nil {
295298
return fmt.Errorf("error printing file '%s': %w", path, err)
296299
}
297300
if err := os.WriteFile(path, []byte(out.String()), 0644); err != nil {

0 commit comments

Comments
 (0)