Closed madneal closed 4 months ago
This PR is aimed to provide a better suport for the json format.
For the orginal json flag provided by checker.go, it's impossible to get analysisflags.JSON from nilaway. There is a conflict bettwen the pretty-print and json output currently due to the code https://github.com/uber-go/nilaway/blob/e90288479601315af13b7fdd3ccd6b50c53a8e7c/nilaway.go#L43. As the default conf.PrettyPrint is true, so the output will be messy when try to output as json.
analysisflags.JSON
pretty-print
json
conf.PrettyPrint
format
Can use this flag like this:
nilaway -format="json" ./...
All committers have signed the CLA.
@yuxincs can u help to review this?
there are still some issues for this PR, I will try to fix them at first.
This PR is aimed to provide a better suport for the json format.
Current Issue
For the orginal json flag provided by checker.go, it's impossible to get
analysisflags.JSON
from nilaway. There is a conflict bettwen thepretty-print
andjson
output currently due to the code https://github.com/uber-go/nilaway/blob/e90288479601315af13b7fdd3ccd6b50c53a8e7c/nilaway.go#L43. As the defaultconf.PrettyPrint
is true, so the output will be messy when try to output as json.Pros
format
flag, it's possible to implement the output format by nilaway itself.Can use this flag like this: