🗺️

Swagger

编写文档

文档规则请参考:https://github.com/swaggo/swag#declarative-comments-format
// file: router/router.go package router import ( "github.com/sohaha/zlsgo/znet" swagger "github.com/sohaha/zlsgo-swagger" _ "app/docs ) // @title app // @version 1.0.0 // @description zlsgo app // @basePath / // @contact.name Seekwe // @contact.email [email protected] func Register() { r := znet.New() // 注册到 /docs/ swagger.RegisterDocs(r) znet.Run() }

生成文档

go get -u github.com/swaggo/swag/cmd/swag swag init -g router/router.go -o ./docs/swagger/