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 505
Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 29 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12
Windows 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
Mac 0 0 0 0 1 0 1 0 0 0 0 0 0 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 1
Linux 0 0 0 0 0 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 0 0 1 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.