Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复生成的结构体 tag 字段错误以及其它注释和尾部空格问题 #1968

Merged

Conversation

huiyifyj
Copy link
Contributor

  • 修复生成的结构体 tag 字段错误
    text/template 标准包会把减号符号的空格全去除,造成以下示例显示的状况:
Config datatypes.JSON `json:"config" form:"config" gorm:"column:config;comment:配置,json;type:text;"swaggertype:"object"` //配置,json
  • 移除字段注释多余尾部空格
  • 文件模板注释 @accept 保持规范规范一致,即开头 A 大写



go 的模板文件,建议后缀保持一致,server\resource 文件夹下 plugin 下的模板文件后缀可以从 .template 后缀改成 .tpl.
当然这只是个人建议...

修复生成的 go 文件中的结构体 tag 字段存在各 key-value 对黏在一起的情况,需要用空格区隔
text/template 标准包会把减号符号的空格全去除,造成以下示例显示的状况:

Config datatypes.JSON `json:"config" form:"config" gorm:"column:config;comment:配置,json;type:text;"swaggertype:"object"` //配置,json
@pixelmaxQm
Copy link
Collaborator

可以修改为tpl,由于模板的基层代码是两个人做的,命名没有统一。

@pixelmaxQm pixelmaxQm merged commit 532d282 into flipped-aurora:main Dec 20, 2024
8 checks passed
@huiyifyj huiyifyj deleted the template-minus-sign-and-space branch December 21, 2024 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants