使用方法
- 打开 GoLand 设置窗口(Windows 快捷键 Ctrl + Alt +S);
- 依次点击 编辑器(Editor) → 实时模板(Live Template) → Go Struct Tags;
- 复制以下代码,右键粘贴(Windows 快捷键 Ctrl + V);
- 点击设置窗口的 确定 按钮,就可以在 Go 结构体标签中自动提示完成相关标签了。
配置代码
<template name="binding" value="`binding:"$END$"`" description="`binding:""`" toReformat="true" toShortenFQNames="true">
<context>
<option name="GO_TAG" value="true" />
</context>
</template>
<template name="example" value="`example:"$END$"`" description="`example:""`" toReformat="true" toShortenFQNames="true">
<context>
<option name="GO_TAG" value="true" />
</context>
</template>
<template name="gorm" value="`gorm:"column:$FIELD_NAME$;"$END$`" description="`gorm:"column:;"`" toReformat="true" toShortenFQNames="true">
<variable name="FIELD_NAME" expression="snakeCase(fieldName())" defaultValue="" alwaysStopAt="true" />
<context>
<option name="GO_TAG" value="true" />
</context>
</template>
<template name="swaggerignore" value="`swaggerignore:"true"$END$`" description="`swaggerignore:"true"`" toReformat="false" toShortenFQNames="true">
<context>
<option name="GO_TAG" value="true" />
</context>
</template>
<template name="swaggertype" value="`swaggertype:"object,string"$END$`" description="`swaggertype:"object,string"`" toReformat="false" toShortenFQNames="true">
<context>
<option name="GO_TAG" value="true" />
</context>
</template>
<template name="title" value="`title:"$END$"`" description="`title:""`" toReformat="true" toShortenFQNames="true">
<context>
<option name="GO_TAG" value="true" />
</context>
</template>
