Skip to content
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

fix: string cutset method usage #1406

Merged
merged 1 commit into from
Jan 12, 2023

Conversation

ismdeep
Copy link
Contributor

@ismdeep ismdeep commented Dec 5, 2022

Describe the PR
Here we are going to trim //, /* at the comment before and */ last, should use TrimPrefix and TrimSuffix instead of TrimLeft and TrimRight.

Relation issue
None

@ubogdan
Copy link
Contributor

ubogdan commented Dec 5, 2022

Please add unit tests that "ensure" this change is genuine and won't be reverted by mistake at a later time.

@codecov
Copy link

codecov bot commented Dec 5, 2022

Codecov Report

Base: 85.16% // Head: 85.16% // No change to project coverage 👍

Coverage data is based on head (a01dc37) compared to base (3fe9ca2).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head a01dc37 differs from pull request most recent head f13c7fb. Consider uploading reports for the commit f13c7fb to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1406   +/-   ##
=======================================
  Coverage   85.16%   85.16%           
=======================================
  Files          19       19           
  Lines        3620     3620           
=======================================
  Hits         3083     3083           
  Misses        459      459           
  Partials       78       78           
Impacted Files Coverage Δ
packages.go 89.09% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sdghchj
Copy link
Member

sdghchj commented Dec 14, 2022

Please add unit tests that "ensure" this change is genuine and won't be reverted by mistake at a later time.

No need actually, it has already been covered by tests.

But, here we have to discuss, if a const with comment like

type Type string
const Teacher Type = "teacher" //// teacher

whether the invalid comment is teacher or // teacher ?

Maybe TrimPrefix and TrimSuffix are more accurate than TrimLeft and TrimRight.

The standard lib has provide a method to extract the comment text, but with a \n at the end.

func (g *CommentGroup) Text() string{
  ...
}

@sdghchj sdghchj merged commit 0d72fbd into swaggo:master Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants