swag
swag copied to clipboard
Use v1.8.2 to run swag fmt command, deleted the preset space between the '//' and '@' symbols
Is your feature request related to a problem? Please describe.
Before v1.8.2, using swag fmt
command will not delete the preset space between //
and @
, and the format in GoLand suspension prompt is normal.
After using v1.8.2, delete the extra space between //
and @
, resulting in a line in the GoLand suspension prompt:
- v1.8.1
// StdDatasourceController 标准数据源配置表 [std_datasource] 请求控制器
//
// @Author iTanken
// @Version 2022-03-21
type StdDatasourceController struct {
Service *service.StdDatasourceService
}
// Create godoc
// @tags 标准数据源配置
// @Summary 添加标准数据源配置信息
// @Description 根据数据库类型、连接地址、用户名和密码等信息添加数据源配置信息。
// @Accept json
// @Produce json
// @Param data body model.StdDatasource true "标准数据源配置信息"
// @Success 200 {object} global.ResFull "添加成功信息,状态码为 200"
// @Failure 400 {object} tool.MsgStatus "出错失败信息,状态码为 1"
// @Failure 401 {object} global.ResBase "登录验证失败,状态码为 505"
// @Security ApiKeyAuth
// @Router /granada/api/v1/std/datasource [post]
func (r StdDatasourceController) Create(ctx *gin.Context) {
...
- v1.8.2
// StdDatasourceController 标准数据源配置表 [std_datasource] 请求控制器
//
// @Author iTanken
// @Version 2022-03-21
type StdDatasourceController struct {
Service *service.StdDatasourceService
}
// Create godoc
// @tags 标准数据源配置
// @Summary 添加标准数据源配置信息
// @Description 根据数据库类型、连接地址、用户名和密码等信息添加数据源配置信息。
// @Accept json
// @Produce json
// @Param data body model.StdDatasource true "标准数据源配置信息"
// @Success 200 {object} global.ResFull "添加成功信息,状态码为 200"
// @Failure 400 {object} tool.MsgStatus "出错失败信息,状态码为 1"
// @Failure 401 {object} global.ResBase "登录验证失败,状态码为 505"
// @Security ApiKeyAuth
// @Router /granada/api/v1/std/datasource [post]
func (r StdDatasourceController) Create(ctx *gin.Context) {
...
Describe the solution you'd like
Do not delete the preset space between the '//' and '@' symbols when running the swag fmt
command.
Additional context
> swag fmt
2022/05/16 11:05:37 fmt: rename C:\Users\User\AppData\Local\Temp\main.go3146305481 main.go: The system cannot move the file to a different disk drive.
- Use v1.8.1 in VS Code:
- Use v1.8.2 in VS Code:
That issue seems to be resolved in the meantime.
Using swag v1.18.12, the formatter introduced an extra space/newline between the GoDoc and the swagger tags.
@iTanken could you verify please, and maybe close this issue, if no more relevant?
@nitram509 Thanks! It seems that the formatting in v1.8.12 has indeed resolved the issue. However, replacing some of the space characters with tabs may have caused some content to appear misaligned, but it shouldn't have a significant impact. Nonetheless, I'm glad that it's working well overall. Thank you once again!