Skip to content

Commit 29fff7c

Browse files
committed
go fmt ./...
1 parent 13b11e0 commit 29fff7c

35 files changed

+1232
-1310
lines changed

codegen/generator/docs.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
Package generator contains the code generation algorithms for a service server,
33
client, and OpenAPI specification.
44
5-
Server and Client
5+
# Server and Client
66
77
The code generated for the service server and client includes:
88
9-
- A `service` package that contains the declarations for the service
10-
interfaces and endpoints which wrap the service methods.
11-
- A `views` package that contains code to render a result type using a view.
12-
- transport specific packages for each of the transports defined in the
13-
design.
14-
- An example implementation of the client, server, and the service.
9+
- A `service` package that contains the declarations for the service
10+
interfaces and endpoints which wrap the service methods.
11+
- A `views` package that contains code to render a result type using a view.
12+
- transport specific packages for each of the transports defined in the
13+
design.
14+
- An example implementation of the client, server, and the service.
1515
16-
OpenAPI
16+
# OpenAPI
1717
1818
The OpenAPI generator generates a OpenAPI v2 specification for the service
1919
REST endpoints. This generator requires the design to define the HTTP transport.

dsl/api.go

Lines changed: 73 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,31 @@ import (
1616
//
1717
// Example:
1818
//
19-
// var _ = API("adder", func() {
20-
// Title("title") // Title used in documentation
21-
// Description("description") // Description used in documentation
22-
// Version("2.0") // Version of API
23-
// TermsOfService("terms") // Terms of use
24-
// Contact(func() { // Contact info
25-
// Name("contact name")
26-
// Email("contact email")
27-
// URL("contact URL")
28-
// })
29-
// License(func() { // License
30-
// Name("license name")
31-
// URL("license URL")
32-
// })
33-
// Docs(func() { // Documentation links
34-
// Description("doc description")
35-
// URL("doc URL")
36-
// })
37-
// Server("addersvr", func() {
38-
// Host("development", func() {
39-
// URI("http://localhost:80")
40-
// URI("grpc://localhost:8080")
41-
// })
42-
// })
43-
// }
44-
//
19+
// var _ = API("adder", func() {
20+
// Title("title") // Title used in documentation
21+
// Description("description") // Description used in documentation
22+
// Version("2.0") // Version of API
23+
// TermsOfService("terms") // Terms of use
24+
// Contact(func() { // Contact info
25+
// Name("contact name")
26+
// Email("contact email")
27+
// URL("contact URL")
28+
// })
29+
// License(func() { // License
30+
// Name("license name")
31+
// URL("license URL")
32+
// })
33+
// Docs(func() { // Documentation links
34+
// Description("doc description")
35+
// URL("doc URL")
36+
// })
37+
// Server("addersvr", func() {
38+
// Host("development", func() {
39+
// URI("http://localhost:80")
40+
// URI("grpc://localhost:8080")
41+
// })
42+
// })
43+
// }
4544
func API(name string, fn func()) *expr.APIExpr {
4645
if name == "" {
4746
eval.ReportError("API first argument cannot be empty")
@@ -63,10 +62,9 @@ func API(name string, fn func()) *expr.APIExpr {
6362
//
6463
// Example:
6564
//
66-
// var _ = API("divider", func() {
67-
// Title("divider API")
68-
// })
69-
//
65+
// var _ = API("divider", func() {
66+
// Title("divider API")
67+
// })
7068
func Title(val string) {
7169
if s, ok := eval.Current().(*expr.APIExpr); ok {
7270
s.Title = val
@@ -83,10 +81,9 @@ func Title(val string) {
8381
//
8482
// Example:
8583
//
86-
// var _ = API("divider", func() {
87-
// Version("1.0")
88-
// })
89-
//
84+
// var _ = API("divider", func() {
85+
// Version("1.0")
86+
// })
9087
func Version(ver string) {
9188
if s, ok := eval.Current().(*expr.APIExpr); ok {
9289
s.Version = ver
@@ -103,14 +100,13 @@ func Version(ver string) {
103100
//
104101
// Example:
105102
//
106-
// var _ = API("divider", func() {
107-
// Contact(func() {
108-
// Name("support")
109-
// Email("[email protected]")
110-
// URL("https://goa.design")
111-
// })
112-
// })
113-
//
103+
// var _ = API("divider", func() {
104+
// Contact(func() {
105+
// Name("support")
106+
// Email("[email protected]")
107+
// URL("https://goa.design")
108+
// })
109+
// })
114110
func Contact(fn func()) {
115111
contact := new(expr.ContactExpr)
116112
if !eval.Execute(fn, contact) {
@@ -131,13 +127,12 @@ func Contact(fn func()) {
131127
//
132128
// Example:
133129
//
134-
// var _ = API("divider", func() {
135-
// License(func() {
136-
// Name("MIT")
137-
// URL("https://github.com/goadesign/goa/blob/master/LICENSE")
138-
// })
139-
// })
140-
//
130+
// var _ = API("divider", func() {
131+
// License(func() {
132+
// Name("MIT")
133+
// URL("https://github.com/goadesign/goa/blob/master/LICENSE")
134+
// })
135+
// })
141136
func License(fn func()) {
142137
license := new(expr.LicenseExpr)
143138
if !eval.Execute(fn, license) {
@@ -162,18 +157,18 @@ func License(fn func()) {
162157
//
163158
// Example:
164159
//
165-
// var _ = API("divider", func() {
166-
// Randomizer(expr.NewFakerRandomizer("different seed"))
167-
// })
160+
// var _ = API("divider", func() {
161+
// Randomizer(expr.NewFakerRandomizer("different seed"))
162+
// })
168163
//
169164
// There's also a deterministic randomizer which will only generate one example
170165
// for each type, so all strings are "abc123", all ints are 1, etc.
171166
//
172167
// Example:
173168
//
174-
// var _ = API("divider", func() {
175-
// Randomizer(expr.NewDeterministicRandomizer())
176-
// })
169+
// var _ = API("divider", func() {
170+
// Randomizer(expr.NewDeterministicRandomizer())
171+
// })
177172
func Randomizer(randomizer expr.Randomizer) {
178173
if s, ok := eval.Current().(*expr.APIExpr); ok {
179174
s.ExampleGenerator = &expr.ExampleGenerator{Randomizer: randomizer}
@@ -191,13 +186,12 @@ func Randomizer(randomizer expr.Randomizer) {
191186
//
192187
// Example:
193188
//
194-
// var _ = API("cellar", func() {
195-
// Docs(func() {
196-
// Description("Additional documentation")
197-
// URL("https://goa.design")
198-
// })
199-
// })
200-
//
189+
// var _ = API("cellar", func() {
190+
// Docs(func() {
191+
// Description("Additional documentation")
192+
// URL("https://goa.design")
193+
// })
194+
// })
201195
func Docs(fn func()) {
202196
docs := new(expr.DocsExpr)
203197
if !eval.Execute(fn, docs) {
@@ -227,10 +221,9 @@ func Docs(fn func()) {
227221
//
228222
// Example:
229223
//
230-
// var _ = API("github", func() {
231-
// TermsOfService("https://help.github.com/articles/github-terms-of-API/"
232-
// })
233-
//
224+
// var _ = API("github", func() {
225+
// TermsOfService("https://help.github.com/articles/github-terms-of-API/"
226+
// })
234227
func TermsOfService(terms string) {
235228
if s, ok := eval.Current().(*expr.APIExpr); ok {
236229
s.TermsOfService = terms
@@ -247,13 +240,12 @@ func TermsOfService(terms string) {
247240
//
248241
// Example:
249242
//
250-
// var _ = API("divider", func() {
251-
// License(func() {
252-
// Name("MIT")
253-
// URL("https://github.com/goadesign/goa/blob/master/LICENSE")
254-
// })
255-
// })
256-
//
243+
// var _ = API("divider", func() {
244+
// License(func() {
245+
// Name("MIT")
246+
// URL("https://github.com/goadesign/goa/blob/master/LICENSE")
247+
// })
248+
// })
257249
func Name(name string) {
258250
switch def := eval.Current().(type) {
259251
case *expr.ContactExpr:
@@ -273,12 +265,11 @@ func Name(name string) {
273265
//
274266
// Example:
275267
//
276-
// var _ = API("divider", func() {
277-
// Contact(func() {
278-
// Email("[email protected]")
279-
// })
280-
// })
281-
//
268+
// var _ = API("divider", func() {
269+
// Contact(func() {
270+
// Email("[email protected]")
271+
// })
272+
// })
282273
func Email(email string) {
283274
if c, ok := eval.Current().(*expr.ContactExpr); ok {
284275
c.Email = email
@@ -293,10 +284,9 @@ func Email(email string) {
293284
//
294285
// Example:
295286
//
296-
// Docs(func() {
297-
// URL("https://goa.design")
298-
// })
299-
//
287+
// Docs(func() {
288+
// URL("https://goa.design")
289+
// })
300290
func URL(url string) {
301291
switch def := eval.Current().(type) {
302292
case *expr.ContactExpr:

0 commit comments

Comments
 (0)