GIN集成swagger时出现Failed to load sp
2020-03-26 本文已影响0人
Reflection_Boom
在router文件引入swagger生成的docs文件夹即可
image.png
image.png

一般来说集成swagger只需要安装以下三个包即可
$ go get -u github.com/swaggo/swag/cmd/swag
$ go get -u github.com/swaggo/gin-swagger
$ go get -u github.com/swaggo/gin-swagger/swaggerFiles
但有的时候可能会没有没有安装到其中一个依赖包
github.com/alecthomas/template
导致引入docs错误或者无法引用,使用go get 装一下template包就好
之后再进行访问
