Repository navigation
Conversation
a4738ba to
ec32158
Compare
This adds a boolean flag, `--ignore-func-signatures`, which allows users to bypass shortening logic for function declarations and types. This enables keeping function signatures with many parameters on a single line, adhering more closely to standard library idioms where signatures often exceed global line length limits.
ec32158 to
6a2ee9e
Compare
|
Hi @ldez , friendly ping on this PR! I noticed you assigned yourself for review back in April, and I wanted to follow up. I also see the CI checks are currently waiting to be run. Please let me know if there's anything you need from my side to help move this forward, or if you have any feedback on the implementation. Thanks! |
|
Hi @ldez, I am just checking in again since it has been a little over a month. I know you are likely very busy with other priorities right now. I am still available to address any feedback or make changes to this PR whenever you have a chance to take a look. Thanks! |
|
Hi @ldez, just wanted to check in and see if you've had a chance to take a look at this. Happy to rebase or make any adjustments whenever you have time. Thanks! |
Addresses Discussion #31
Description
This PR introduces a new boolean flag,
--ignore-func-signatures, which allows users to bypass the line-shortening logic specifically for function declarations and function types.By default,
golinesapplies the--max-lenlimit uniformly across all AST nodes, which can force function signatures with multiple parameters to wrap across several lines. The Go standard library frequently keeps function signatures on a single line even when they exceed typical column limits (e.g., inimage/draw).This flag gives users the option to strictly format the bodies of their functions and structs to a specific length while maintaining idiomatic, single-line function signatures, eliminating the need to rely on
//golines:ignorecomments above every long signature.Changes Made
--ignore-func-signaturesboolean flag (default:false) to the CLI.shorten.Config.formatDecl(*dst.FuncDecl) andformatExpr(*dst.FuncType) inshorten/format.goto conditionally bypass formatting the parameter list if the flag is enabled.shorten/testdata/ignore_func_signaturesto verify the behavior.README.mdwith documentation for the new flag.