Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Go struct tagNew to Visual Studio Code? Get it now.
Go struct tag

Go struct tag

liuchao

|
25,029 installs
| (4) | Free
Autocomplete Go struct tags
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

go-struct-tag

A Visual Studio Code extension for autocompleting Go struct tags while typing.

Note

If the extension doesn't work, please add the following configuration in settings.json:

Open Command Palette (⌘ + ⇧ + P) then Preferences: Open Settings (JSON)

    "editor.quickSuggestions": {
        "strings": true
    }
    "editor.suggest.showWords": true,

Configuration

go-struct-tag.cases

Add entries into go-struct-tag.cases to set the field name format.

Supported formats:

  • snake
  • camel
  • pascal
  • constant
  • none

Below are the default settings:

    "go-struct-tag.cases": [
        "snake",
        "camel"
    ]

go-struct-tag.customTags

Use custom tags.

Example:

    "go-struct-tag.customTags": {
        "customTag1": {
            "cases": [
                "snake"
            ],
            "options": [
                "omitempty",
                "string",
                "-"
            ],
            "separator": ","
        },
        "customTag2": {
            "cases": []
        },
        "customTag3": {}
    }
  • customTag1, customTag2, customTag3: Custom tag names
  • cases: Field name formatting for this tag. If not set, it uses the value of go-struct-tag.cases. If set to [], the field name will not be used.
  • options: A list of options following the field name. If not set, no options will be used.
  • separator: Separator between options. If not set, it defaults to ,.

Features

Default supported tags:

  • json: https://pkg.go.dev/encoding/json
  • bson: https://pkg.go.dev/go.mongodb.org/mongo-driver/bson
  • xorm: https://xorm.io/docs/
  • gorm: https://gorm.io/docs/index.html
  • form: https://github.com/gin-gonic/gin
  • yaml: https://pkg.go.dev/gopkg.in/yaml.v3
  • binding: https://github.com/gin-gonic/gin
  • env: https://github.com/caarlos0/env
  • validate: https://github.com/gin-gonic/gin
  • mapstructure: https://github.com/mitchellh/mapstructure
  • redis: https://github.com/gomodule/redigo

json

bson

xorm

gorm

form

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft