ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Go​Tags

by howcrazy ALL

GoTags is a Sublime Text plugin to append or remove tags for Golang struct.

Details

Installs

  • Total 8K
  • Win 6K
  • Mac 1K
  • Linux 516
Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25 Aug 24 Aug 23 Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3 Aug 2 Aug 1 Jul 31 Jul 30 Jul 29 Jul 28 Jul 27 Jul 26
Windows 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 2 0 0 0 1 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 2
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 1 1 0 0 0 0 0 0 1 0 0 0
Linux 1 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

GoTags

GoTags is a Sublime Text plugin to append or remove tags for Golang struct.

Functionality includes:

  • Append JSON tag with snake cased field name or remove JSON tag
  • Append XML tag with snake cased field name or remove XML tag
  • Append Xorm tag with xorm field type or remove Xorm tag

Usage

By default via the keyboard shortcut: Super + Shift + G, Super + Shift + T on OSX or Ctrl + Shift + G, Ctrl + Shift + T on other platforms(or change it in ${packages}/User/Default (plantform).sublime-keymap). Then choice the action you want.

** Makesure lines type STRUCT_NAME struct{ are in select region. **

For example:

type Example struct {
    FieldOne int       ``         // int field
    FieldTwo string    `orig tag` // string field
    FieldThree time.Time // time field
}

Then select type Example struct { line (or this is current line) and type the shortcut, select action JSON: Append tags:

type Example struct {
    FieldOne    int    `json:"field_one"`         // int field
    FieldTwo    string    `orig tag json:"field_two"` // string field
    FieldThree    time.Time    `json:"field_three"` // time field
}

After save with gofmt:

type Example struct {
    FieldOne   int       `json:"field_one"`          // int field
    FieldTwo   string    `orig tag json:"field_two"` // string field
    FieldThree time.Time `json:"field_three"`        // time field
}

Idea from:

gotag: golang auto generate struct tag.