pingcap / failpoint

An implementation of failpoints for Golang.
Apache License 2.0
817 stars 63 forks source link

code: use format.Node for output that matches gofmt #38

Closed amyangfei closed 5 years ago

amyangfei commented 5 years ago

What problem does this PR solve?

Currently we use printer.Fprint to print an AST node to output. It calls Config.Fprint with default settings, which uses tabs for both indentation and alignment. However gofmt uses tabs for indentation but spaces for alignment. So in most scenarios failpoint-ctl enable will change struct declaration and assignment code which is not relevant to failpoint injection.

What is changed and how it works?

use format.Node for output that matches gofmt

Check List

Tests

codecov[bot] commented 5 years ago

Codecov Report

Merging #38 into master will not change coverage. The diff coverage is 100%.

@@             Coverage Diff             @@
##             master        #38   +/-   ##
===========================================
  Coverage   86.4238%   86.4238%           
===========================================
  Files             7          7           
  Lines           906        906           
===========================================
  Hits            783        783           
  Misses           77         77           
  Partials         46         46
amyangfei commented 5 years ago

PTAL @lonng @kennytm