gtag is a simple tool for Golang tag, currently only support for tag formatter.
it'll transform your mess struct tag into beauty one
This tool requires Go installed. To get the latest released version use:
GO111MODULE=off go get github.com/adzimzf/gtag/cmd/gtag
go install github.com/adzimzf/gtag/cmd/gtag
-
- To integrate with Goland you need file watcher plugin
- Go to file watcher setting
- Click
+
button or pressAlt+Insert
- Select custom
- Fill the program input field with
<Your go bin location>/gtag
-
- To integrate with VSCode you need this plugin
- After you have already installed it, press
CTRL+P
then searchsetting.json
to edit your file configuration - Add the file with this json
"runOnSave.commands": [ { "match": ".*\\.go$", "notMatch": "[\\\\\\/]_[^\\\\\\/]*\\.go$", "command": "gtag -i=${file} -w", "runIn": "backend" }, ]
- Save it, and whenever you save it'll reformat your struct tags