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