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

gin-admin-cli生成的项目有问题 #143

Open
mchongjs opened this issue Nov 18, 2023 · 3 comments
Open

gin-admin-cli生成的项目有问题 #143

mchongjs opened this issue Nov 18, 2023 · 3 comments

Comments

@mchongjs
Copy link

用gin-admin-cli生成的项目,在internal\swagger\docs.go 的2014,2015行会多生成2个字段,导致无法编译和运行

// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
	Version:          "v1.0.0",
	Host:             "",
	BasePath:         "",
	Schemes:          []string{},
	Title:            "gozrzsv2",
	Description:      "go-zrzsv2 API service",
	InfoInstanceName: "swagger",
	SwaggerTemplate:  docTemplate,
	LeftDelim:        "{{",
	RightDelim:       "}}",
}

最后2个字段会导致报错
internal\swagger\docs.go:2014:2: unknown field LeftDelim in struct literal of type "github.com/swaggo/swag".Spec internal\swagger\docs.go:2015:2: unknown field RightDelim in struct literal of type "github.com/swaggo/swag".Spec

@LyricTian
Copy link
Owner

可以尝试升级下本地的 swag 命令,这是生成 swagger 文档导致的,我本地没有复现这个问题

go install github.com/swaggo/swag/cmd/swag@latest

@LiuYiDi2
Copy link

LiuYiDi2 commented Jan 9, 2024

这个问题我也出现了 也确认swag是最新版本,go install 更新未解决,用go get 更新swagger后解决的,go get应该会更新一些swag编译的依赖,楼主可以试一下

@kisy
Copy link

kisy commented Jan 12, 2024

应该是 go.mod 文件未更新所致

手动修改 go.mod文件也可以解决

// github.com/swaggo/swag v1.8.12 
github.com/swaggo/swag v1.16.2

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

No branches or pull requests

4 participants