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

Document option to tag all structs #60

Closed
eduhenke opened this issue May 7, 2020 · 1 comment · Fixed by #61
Closed

Document option to tag all structs #60

eduhenke opened this issue May 7, 2020 · 1 comment · Fixed by #61
Assignees

Comments

@eduhenke
Copy link

eduhenke commented May 7, 2020

I had to search in the issues to see a way for all structs to be used in the file, almost not using this lib(which is great, by the way! only missing a few tiny things, that may hinder the usability). Which I've found the solution to be, to pass line 1,100000.

As for the behavior I expected when I used the gomodifytags command, it would be:

  • gomodifytags -file <file>.go: parses entire file, modify all structs, because no filter option passed
  • gomodifytags -file <file>.go -struct/-line/-offset: gets the entire file, apply the filter, only modify structs that were filtered

But, I don't know if that's everyone's expected behavior, so to at least cover this use case, we could at least document this hidden option, or implement it the proper way(without the line workaround, at least not to the end-user)

@fatih fatih self-assigned this May 10, 2020
fatih added a commit that referenced this issue May 10, 2020
@fatih
Copy link
Owner

fatih commented May 10, 2020

Thanks for the feedback @eduhenke You're right. gomodifytags is intended to be used with an editor, hence it never had options to modify the whole file. But I think it's a legit use case. A user could say "Add tags to all structs in the current file". The editor has the knowledge already (file length in numbers), but a command line user doesn't know it.

I've opened a Pull request thats adds the new -all flag which selects all structs: #61 Please use it and let me know what you think about it.

@fatih fatih closed this as completed in #61 May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants