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

:GoAddTags with nested structs #990

Closed
dvcrn opened this issue Aug 3, 2016 · 4 comments
Closed

:GoAddTags with nested structs #990

dvcrn opened this issue Aug 3, 2016 · 4 comments

Comments

@dvcrn
Copy link

dvcrn commented Aug 3, 2016

Thanks a lot for :GoAddTags. It already saved me so much time!

I noticed that tag generation for nested structs seem to not work correctly:

type Foo struct {
    One   string
    Two   string
    Three string
    Bar   struct {
        Four string
        Five string
    }
}

after :GoAddTags

type Foo struct {
    One   string `json:"one"`
    Two   string `json:"two"`
    Three string `json:"three"`
    Bar   struct { `json:"bar"`   <------
        Four string `json:"four"`
        Five string `json:"five"`
    }
}

How it should be:


type Foo struct {
    One   string `json:"one"`
    Two   string `json:"two"`
    Three string `json:"three"`
    Bar   struct {
        Four string `json:"four"`
        Five string `json:"five"`
    } `json:"bar"`         <------
}
@fatih
Copy link
Owner

fatih commented Aug 7, 2016

Thanks @dvcrn

I'm planning to move :GoAddTags to use the tool motion (which supports AST based output). It'll cover all these cases for us. Thanks!

@dvcrn
Copy link
Author

dvcrn commented Oct 28, 2016

Hi fatih, is there anything new on this?
If you could give me some implementation details I could also try to help you with this

@fatih
Copy link
Owner

fatih commented Jan 21, 2017

@dvcrn I'm currently working on this, will update and close this issue once it's ready

fatih added a commit that referenced this issue Feb 13, 2017
* 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
fatih added a commit that referenced this issue Feb 13, 2017
* 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
fatih added a commit that referenced this issue Feb 13, 2017
* 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
fatih added a commit that referenced this issue Feb 13, 2017
* 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
@fatih
Copy link
Owner

fatih commented Feb 14, 2017

Fixed with #1204 please, feel free to test and reopen if it's not the case.

@fatih fatih closed this as completed Feb 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants