-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add command for format the swag comment. #1056
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1056 +/- ##
==========================================
+ Coverage 93.46% 94.42% +0.96%
==========================================
Files 8 9 +1
Lines 2127 2261 +134
==========================================
+ Hits 1988 2135 +147
+ Misses 77 66 -11
+ Partials 62 60 -2
Continue to review full report at Codecov.
|
@HYY-yu This is pretty impressive PR, and I feel it will be a nice and valuable feature for our community. Would you mind fixing the coverage so we may merge and include this in the 1.7.5 version? |
It's very hard to improving coverage, I had to use the Monkey test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I know the main focus on PR is the code. In the end, we are adding these features to improve the development experience. |
Sure, I'll add to README later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@HYY-yu Thanks for your contribution. |
Describe the PR
Hello, Please see a example:
As you can see, If I have a lot of params, The format of comment will look very messy.
So, we can create a command like
gofmt
, It automatically formats the "swag" comments.Like this:
How it works
just like
go fmt
, It usetext/tabwriter
to format the comment. It scans the swag comments, especially '@param', '@success', '@response', etc, recognize their boundaries, calltext/tabwriter
to format them. See the source code for more details.Relation issue
Additional context