-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
GoAddTags: tag options #985
Comments
Hi @tobstarr This and the second PR (#984) you opened, I wanted to do in the next release ;) I didn't wanted to put a lot of features. So adding them one by one is the way to go 👍 Tag options is easy, however for the second one we need to parse the string (might be a little bit complicated, but doable). I'll keep an eye on this. If someone else want to tackle it feel free to pick it up, but let me know before if you do it. |
* Use new `gomodifytags` tool to manipulate and modify tags * Adds new `:GoRenameTags` * `:GoAddTags` is able to add options * `:GoRemoveTags` is able to remove options Usage: Following command add multiple tags. Does not modify if the key already exist. If `,optionaname` is given, it adds the given option to that key. If called without arguments, it adds by default tags with `json` key. ``` :GoAddTags :GoAddTags json :GoAddTags json,omitempty :GoAddTags json hcl bson :GoAddTags json,omitempty hcl bson ``` Following command removes multiple tags and options. If `,optionname` is given, it removes the option belonging to that key instead of removing the key. If called without arguments, it removes all tags belonging to a struct. ``` :GoRemoveTags :GoRemoveTags json :GoRemoveTags json,omitempty :GoRemoveTags json hcl bson :GoRemoveTags json,omitempty hcl bson ``` Fixes following issues: #984 #985 #990 #1064 #1091
* Use new `gomodifytags` tool to manipulate and modify tags * Adds new `:GoRenameTags` * `:GoAddTags` is able to add options * `:GoRemoveTags` is able to remove options Usage: Following command add multiple tags. Does not modify if the key already exist. If `,optionaname` is given, it adds the given option to that key. If called without arguments, it adds by default tags with `json` key. ``` :GoAddTags :GoAddTags json :GoAddTags json,omitempty :GoAddTags json hcl bson :GoAddTags json,omitempty hcl bson ``` Following command removes multiple tags and options. If `,optionname` is given, it removes the option belonging to that key instead of removing the key. If called without arguments, it removes all tags belonging to a struct. ``` :GoRemoveTags :GoRemoveTags json :GoRemoveTags json,omitempty :GoRemoveTags json hcl bson :GoRemoveTags json,omitempty hcl bson ``` Fixes following issues: #984 #985 #990 #1064 #1091
* Use new `gomodifytags` tool to manipulate and modify tags * `:GoAddTags` is able to add tags and options * `:GoRemoveTags` is able to remove tags and options Usage: Following command add multiple tags. Does not modify if the key already exist. If `,optionaname` is given, it adds the given option to that key. If called without arguments, it adds by default tags with `json` key. ``` :GoAddTags :GoAddTags json :GoAddTags json,omitempty :GoAddTags json hcl bson :GoAddTags json,omitempty hcl bson ``` Following command removes multiple tags and options. If `,optionname` is given, it removes the option belonging to that key instead of removing the key. If called without arguments, it removes all tags belonging to a struct. ``` :GoRemoveTags :GoRemoveTags json :GoRemoveTags json,omitempty :GoRemoveTags json hcl bson :GoRemoveTags json,omitempty hcl bson ``` Fixes following issues: #984 #985 #990 #1064 #1091
* Use new `gomodifytags` tool to manipulate and modify tags * `:GoAddTags` is able to add tags and options * `:GoRemoveTags` is able to remove tags and options Usage: Following command add multiple tags. Does not modify if the key already exist. If `,optionaname` is given, it adds the given option to that key. If called without arguments, it adds by default tags with `json` key. ``` :GoAddTags :GoAddTags json :GoAddTags json,omitempty :GoAddTags json hcl bson :GoAddTags json,omitempty hcl bson ``` Following command removes multiple tags and options. If `,optionname` is given, it removes the option belonging to that key instead of removing the key. If called without arguments, it removes all tags belonging to a struct. ``` :GoRemoveTags :GoRemoveTags json :GoRemoveTags json,omitempty :GoRemoveTags json hcl bson :GoRemoveTags json,omitempty hcl bson ``` Fixes following issues: #984 #985 #990 #1064 #1091
Fixed with #1204 please, feel free to test and reopen if it's not the case. |
@fatih is it intended that |
Yeah it only works if it exists. Previously it was the opposite. The buffer changes because gomodifytags changes the file again, thus the creation time changes as well. Open an issue to https://github.com/fatih/gomodifytags to track if you want :) |
Any particular reason for that? I would find it really handy for I just checked gomodifytag and the call Behaviour before was not the opposite, but that it created this: |
When I mean |
I write a function to implement it (using fatih/gomodifytags)
It seems like |
At least for my workflow it would be nice to be able to also provide e.g. the
omitempty
option when adding ajson
tag to a struct field.I would propose to change the behaviour of
GoAddTags json,omitempty
to producejson:"name,omitempty"
instead ofjson,omitempty:"name"
but I do not know if there are cases where one actually would want to add a tag including a comma character.The text was updated successfully, but these errors were encountered: