initial pass at implementing --fix#52
initial pass at implementing --fix#52mariusvniekerk wants to merge 7 commits intomanuelarte:mainfrom
Conversation
|
Hi @mariusvniekerk, thanks a lot for your comments and for creating this PR! I really appreciate contributions like yours. I haven’t had time to review the draft yet (I have been a bit busy at work), but I’m looking forward to seeing your design and approach for the fix flag. For context, there were previous attempts to implement the fix option (#37 ), but @ldez and I decided not to proceed at that time. We were concerned with the fact of potentially reordering large portions of the code and other details, such as adding all the suggested fixes inside one single diagnostic. |
|
We almost certainly do not want to make this the default behavior likely ever, due to as you say this making a very large change in almost every codebase where this is run. Thats mostly why i had by version rely on a configuration value rather than making use of the --fix flag. Generally this kind of wholesale code reformatting is best done once (and then generally a git blame ignore file) |
Funcorder is a pretty awesome linting tool for golang. I like a lot of what it does and took a stab at implementing functionality to allow it to automatically reformat the code to match the rules requested.
This gated behind an autofix option with several tests ensuring it correctly does the work desired.