Skip to content

Commit 797f531

Browse files
committed
golang: add doc and swagger examples
1 parent c41a84d commit 797f531

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Package docs Code generated by swaggo/swag. DO NOT EDIT
2+
package docs
3+
4+
import "github.com/swaggo/swag"
5+
6+
const docTemplate = `{
7+
"schemes": {{ marshal .Schemes }},
8+
"swagger": "2.0",
9+
"info": {
10+
"description": "{{escape .Description}}",
11+
"title": "{{.Title}}",
12+
"contact": {},
13+
"version": "{{.Version}}"
14+
},
15+
"host": "{{.Host}}",
16+
"basePath": "{{.BasePath}}",
17+
"paths": {}
18+
}`
19+
20+
// SwaggerInfo holds exported Swagger Info so clients can modify it
21+
var SwaggerInfo = &swag.Spec{
22+
Version: "",
23+
Host: "",
24+
BasePath: "",
25+
Schemes: []string{},
26+
Title: "",
27+
Description: "",
28+
InfoInstanceName: "swagger",
29+
SwaggerTemplate: docTemplate,
30+
LeftDelim: "{{",
31+
RightDelim: "}}",
32+
}
33+
34+
func init() {
35+
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
36+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"contact": {}
5+
},
6+
"paths": {}
7+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
info:
2+
contact: {}
3+
paths: {}
4+
swagger: "2.0"

runtime/golang/helloworld/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
//go:build linux || darwin || windows
22

3+
// Package main implements utility routines for manipulating ...
4+
//
5+
// The main package should be used for lorem ipsum dolor sit amet, consectetur
6+
// adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
7+
// aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
8+
// nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
9+
// reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
10+
// pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
11+
// officia deserunt mollit anim id est laborum.
312
package main
413

514
import (
@@ -35,6 +44,8 @@ func uuid() string {
3544
return C.GoString(C._go_uuid())
3645
}
3746

47+
48+
3849
func main() {
3950
fmt.Println("Hello, World!")
4051
fmt.Println(quote.Hello())

0 commit comments

Comments
 (0)