package docs import ( "bytes" "encoding/json" "github.com/alecthomas/template" "github.com/swaggo/swag" ) var doc =`` type swaggerInfo struct { Version string Host string BasePath string Schemes []string Title string Description string } // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = swaggerInfo{ Schemes: []string{}} type s struct{} func (s *s) ReadDoc() string { t, err := template.New("swagger_info").Funcs(template.FuncMap{ "marshal": func(v interface {}) string { a, _ := json.Marshal(v) return string(a) }, }).Parse(doc) if err != nil { return doc } var tpl bytes.Buffer if err := t.Execute(&tpl, SwaggerInfo); err != nil { return doc } return tpl.String() } func init() { swag.Register(swag.Name, &s{}) }