解决方案
bug 总结
swag init 生成了 docs.go,但 Go 编译器不会自动把它编进二进制;
必须显式 import _ "项目/docs",否则 Swagger 处理器找不到文档数据,就空 500。
bash
swag init
go
import (
_ "github.com/项目/docs" // 必须导入生成的 docs 包
)