Skip to content

Commit 97ee66c

Browse files
authored
Merge pull request #564 from Hellcatlk/master
🌱 Fix some gofmt warnings
2 parents ecaffbc + 02265d5 commit 97ee66c

15 files changed

+133
-132
lines changed

cmd/helpgen/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (Generator) RegisterMarkers(reg *markers.Registry) error {
105105
Details: "Type-level godoc becomes general marker summary (first line) and details (other lines). Field-level godoc similarly becomes marker field help.",
106106
},
107107
FieldHelp: map[string]markers.DetailedHelp{
108-
"Category": markers.DetailedHelp{
108+
"Category": {
109109
Summary: "indicates the general category to which this marker belongs",
110110
},
111111
},
@@ -134,7 +134,7 @@ func (g Generator) Generate(ctx *genall.GenerationContext) error {
134134

135135
for _, field := range info.Fields {
136136
summary, details := godocToDetails(field.Name, field.Doc)
137-
fmt.Fprintf(outContent, "%[1]q: markers.DetailedHelp{\nSummary: %[2]q,\n Details: %[3]q,\n},\n", field.Name, summary, details)
137+
fmt.Fprintf(outContent, "%[1]q: {\nSummary: %[2]q,\n Details: %[3]q,\n},\n", field.Name, summary, details)
138138
}
139139

140140
summary, details := godocToDetails(info.Name, info.Doc)
@@ -197,8 +197,8 @@ func (Generator) Help() *markers.DefinitionHelp {
197197
Summary: "generates marker help using godoc, based on the presence of a particular marker",
198198
},
199199
FieldHelp: map[string]markers.DetailedHelp{
200-
"HeaderFile": markers.DetailedHelp{Summary: "the file containing the header to use for generated files"},
201-
"Year": markers.DetailedHelp{Summary: "replace \" YEAR\" in the header with this value."},
200+
"HeaderFile": {Summary: "the file containing the header to use for generated files"},
201+
"Year": {Summary: "replace \" YEAR\" in the header with this value."},
202202
},
203203
}
204204
}

pkg/crd/crd_spec_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var _ = Describe("CRD Generation", func() {
3838
OpenAPIV3Schema: &apiextlegacy.JSONSchemaProps{
3939
Required: []string{"foo"},
4040
Type: "object",
41-
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": apiextlegacy.JSONSchemaProps{Type: "string"}},
41+
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": {Type: "string"}},
4242
},
4343
},
4444
},
@@ -50,7 +50,7 @@ var _ = Describe("CRD Generation", func() {
5050
OpenAPIV3Schema: &apiextlegacy.JSONSchemaProps{
5151
Required: []string{"foo"},
5252
Type: "object",
53-
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": apiextlegacy.JSONSchemaProps{Type: "string"}},
53+
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": {Type: "string"}},
5454
},
5555
}))
5656
Expect(spec.Spec.Versions).To(Equal([]apiextlegacy.CustomResourceDefinitionVersion{
@@ -67,7 +67,7 @@ var _ = Describe("CRD Generation", func() {
6767
OpenAPIV3Schema: &apiextlegacy.JSONSchemaProps{
6868
Required: []string{"foo"},
6969
Type: "object",
70-
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": apiextlegacy.JSONSchemaProps{Type: "string"}},
70+
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": {Type: "string"}},
7171
},
7272
},
7373
},
@@ -78,7 +78,7 @@ var _ = Describe("CRD Generation", func() {
7878
OpenAPIV3Schema: &apiextlegacy.JSONSchemaProps{
7979
Required: []string{"foo"},
8080
Type: "object",
81-
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": apiextlegacy.JSONSchemaProps{Type: "string"}},
81+
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": {Type: "string"}},
8282
},
8383
},
8484
},
@@ -90,7 +90,7 @@ var _ = Describe("CRD Generation", func() {
9090
OpenAPIV3Schema: &apiextlegacy.JSONSchemaProps{
9191
Required: []string{"foo"},
9292
Type: "object",
93-
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": apiextlegacy.JSONSchemaProps{Type: "string"}},
93+
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": {Type: "string"}},
9494
},
9595
}))
9696
Expect(spec.Spec.Versions).To(Equal([]apiextlegacy.CustomResourceDefinitionVersion{
@@ -107,7 +107,7 @@ var _ = Describe("CRD Generation", func() {
107107
Schema: &apiextlegacy.CustomResourceValidation{
108108
OpenAPIV3Schema: &apiextlegacy.JSONSchemaProps{
109109
Type: "object",
110-
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": apiextlegacy.JSONSchemaProps{Type: "string"}},
110+
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": {Type: "string"}},
111111
},
112112
},
113113
},
@@ -118,7 +118,7 @@ var _ = Describe("CRD Generation", func() {
118118
OpenAPIV3Schema: &apiextlegacy.JSONSchemaProps{
119119
Required: []string{"foo"},
120120
Type: "object",
121-
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": apiextlegacy.JSONSchemaProps{Type: "string"}},
121+
Properties: map[string]apiextlegacy.JSONSchemaProps{"foo": {Type: "string"}},
122122
},
123123
},
124124
},

pkg/crd/desc_visitor_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ var _ = Describe("TruncateDescription", func() {
3131
schema := &apiext.JSONSchemaProps{
3232
Description: "top level description",
3333
Properties: map[string]apiext.JSONSchemaProps{
34-
"Spec": apiext.JSONSchemaProps{
34+
"Spec": {
3535
Description: "specification for the API type",
3636
},
3737
},
3838
}
3939
crd.TruncateDescription(schema, 0)
4040
Expect(schema).To(Equal(&apiext.JSONSchemaProps{
4141
Properties: map[string]apiext.JSONSchemaProps{
42-
"Spec": apiext.JSONSchemaProps{},
42+
"Spec": {},
4343
},
4444
}))
4545

@@ -49,7 +49,7 @@ var _ = Describe("TruncateDescription", func() {
4949
schema := &apiext.JSONSchemaProps{
5050
Description: "top level description of the root object.",
5151
Properties: map[string]apiext.JSONSchemaProps{
52-
"Spec": apiext.JSONSchemaProps{
52+
"Spec": {
5353
Description: "specification of a field",
5454
},
5555
},

pkg/crd/flatten_all_of_test.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var _ = Describe("AllOf Flattening", func() {
4949
By("flattening a schema with at one branch set as Nullable")
5050
original := &apiext.JSONSchemaProps{
5151
Properties: map[string]apiext.JSONSchemaProps{
52-
"multiNullable": apiext.JSONSchemaProps{
52+
"multiNullable": {
5353
AllOf: []apiext.JSONSchemaProps{
5454
{Nullable: true}, {Nullable: false}, {Nullable: false},
5555
},
@@ -62,7 +62,7 @@ var _ = Describe("AllOf Flattening", func() {
6262
By("ensuring that the result has no branches and is nullable")
6363
Expect(flattened).To(Equal(&apiext.JSONSchemaProps{
6464
Properties: map[string]apiext.JSONSchemaProps{
65-
"multiNullable": apiext.JSONSchemaProps{Nullable: true},
65+
"multiNullable": {Nullable: true},
6666
},
6767
}))
6868
})
@@ -71,7 +71,7 @@ var _ = Describe("AllOf Flattening", func() {
7171
By("flattening a schema with at no branches set as Nullable")
7272
original := &apiext.JSONSchemaProps{
7373
Properties: map[string]apiext.JSONSchemaProps{
74-
"multiNullable": apiext.JSONSchemaProps{
74+
"multiNullable": {
7575
AllOf: []apiext.JSONSchemaProps{
7676
{Nullable: false}, {Nullable: false}, {Nullable: false},
7777
},
@@ -84,7 +84,7 @@ var _ = Describe("AllOf Flattening", func() {
8484
By("ensuring that the result has no branches and is not nullable")
8585
Expect(flattened).To(Equal(&apiext.JSONSchemaProps{
8686
Properties: map[string]apiext.JSONSchemaProps{
87-
"multiNullable": apiext.JSONSchemaProps{Nullable: false},
87+
"multiNullable": {Nullable: false},
8888
},
8989
}))
9090
})
@@ -113,7 +113,7 @@ var _ = Describe("AllOf Flattening", func() {
113113
defOne := int64(1)
114114
original := &apiext.JSONSchemaProps{
115115
Properties: map[string]apiext.JSONSchemaProps{
116-
"multiAdditionalProps": apiext.JSONSchemaProps{
116+
"multiAdditionalProps": {
117117
AllOf: []apiext.JSONSchemaProps{
118118
{
119119
AdditionalProperties: &apiext.JSONSchemaPropsOrBool{Schema: &apiext.JSONSchemaProps{
@@ -145,7 +145,7 @@ var _ = Describe("AllOf Flattening", func() {
145145
By("ensuring that the result has the minimal set of AllOf branches required, pushed inside AdditionalProperites")
146146
Expect(flattened).To(Equal(&apiext.JSONSchemaProps{
147147
Properties: map[string]apiext.JSONSchemaProps{
148-
"multiAdditionalProps": apiext.JSONSchemaProps{
148+
"multiAdditionalProps": {
149149
AdditionalProperties: &apiext.JSONSchemaPropsOrBool{Schema: &apiext.JSONSchemaProps{
150150
Nullable: true,
151151
MaxLength: &defSeven,
@@ -164,7 +164,7 @@ var _ = Describe("AllOf Flattening", func() {
164164
By("flattening a schema with a single property with two different types")
165165
crd.FlattenEmbedded(&apiext.JSONSchemaProps{
166166
Properties: map[string]apiext.JSONSchemaProps{
167-
"multiType": apiext.JSONSchemaProps{AllOf: []apiext.JSONSchemaProps{{Type: "string"}, {Type: "int"}}},
167+
"multiType": {AllOf: []apiext.JSONSchemaProps{{Type: "string"}, {Type: "int"}}},
168168
},
169169
}, errRec)
170170

@@ -202,21 +202,21 @@ var _ = Describe("AllOf Flattening", func() {
202202
AllOf: []apiext.JSONSchemaProps{
203203
{
204204
Properties: map[string]apiext.JSONSchemaProps{
205-
"nonConflicting": apiext.JSONSchemaProps{Type: "string"},
206-
"conflicting1": apiext.JSONSchemaProps{Type: "string", Format: "date-time"},
207-
"nonConflictingDup": apiext.JSONSchemaProps{Type: "bool"},
205+
"nonConflicting": {Type: "string"},
206+
"conflicting1": {Type: "string", Format: "date-time"},
207+
"nonConflictingDup": {Type: "bool"},
208208
},
209209
},
210210
{
211211
Properties: map[string]apiext.JSONSchemaProps{
212-
"conflicting1": apiext.JSONSchemaProps{Type: "string", MinLength: &defOne},
213-
"conflicting2": apiext.JSONSchemaProps{Type: "int", MultipleOf: &defSeven},
212+
"conflicting1": {Type: "string", MinLength: &defOne},
213+
"conflicting2": {Type: "int", MultipleOf: &defSeven},
214214
},
215215
},
216216
{
217217
Properties: map[string]apiext.JSONSchemaProps{
218-
"conflicting2": apiext.JSONSchemaProps{Type: "int", MultipleOf: &defEight},
219-
"nonConflictingDup": apiext.JSONSchemaProps{Type: "bool"},
218+
"conflicting2": {Type: "int", MultipleOf: &defEight},
219+
"nonConflictingDup": {Type: "bool"},
220220
},
221221
},
222222
},
@@ -227,14 +227,14 @@ var _ = Describe("AllOf Flattening", func() {
227227
By("ensuring that the result has the minimal set of AllOf branches required, pushed inside Properties")
228228
Expect(flattened).To(Equal(&apiext.JSONSchemaProps{
229229
Properties: map[string]apiext.JSONSchemaProps{
230-
"nonConflicting": apiext.JSONSchemaProps{Type: "string"},
231-
"nonConflictingDup": apiext.JSONSchemaProps{Type: "bool"},
232-
"conflicting1": apiext.JSONSchemaProps{
230+
"nonConflicting": {Type: "string"},
231+
"nonConflictingDup": {Type: "bool"},
232+
"conflicting1": {
233233
Type: "string",
234234
Format: "date-time",
235235
MinLength: &defOne,
236236
},
237-
"conflicting2": apiext.JSONSchemaProps{
237+
"conflicting2": {
238238
Type: "int",
239239
AllOf: []apiext.JSONSchemaProps{{MultipleOf: &defSeven}, {MultipleOf: &defEight}},
240240
},
@@ -297,9 +297,9 @@ var _ = Describe("AllOf Flattening", func() {
297297
AllOf: []apiext.JSONSchemaProps{
298298
{
299299
Properties: map[string]apiext.JSONSchemaProps{
300-
"prop1": apiext.JSONSchemaProps{
300+
"prop1": {
301301
Properties: map[string]apiext.JSONSchemaProps{
302-
"prop2": apiext.JSONSchemaProps{
302+
"prop2": {
303303
Type: "string",
304304
Pattern: "^[abc]+$",
305305
},
@@ -309,9 +309,9 @@ var _ = Describe("AllOf Flattening", func() {
309309
},
310310
{
311311
Properties: map[string]apiext.JSONSchemaProps{
312-
"prop1": apiext.JSONSchemaProps{
312+
"prop1": {
313313
Properties: map[string]apiext.JSONSchemaProps{
314-
"prop2": apiext.JSONSchemaProps{
314+
"prop2": {
315315
Pattern: "^(bc)+$",
316316
},
317317
},
@@ -326,9 +326,9 @@ var _ = Describe("AllOf Flattening", func() {
326326
By("ensuring that the result has the minimal AllOf branches possible")
327327
Expect(flattened).To(Equal(&apiext.JSONSchemaProps{
328328
Properties: map[string]apiext.JSONSchemaProps{
329-
"prop1": apiext.JSONSchemaProps{
329+
"prop1": {
330330
Properties: map[string]apiext.JSONSchemaProps{
331-
"prop2": apiext.JSONSchemaProps{
331+
"prop2": {
332332
Type: "string",
333333
AllOf: []apiext.JSONSchemaProps{{Pattern: "^[abc]+$"}, {Pattern: "^(bc)+$"}},
334334
},

0 commit comments

Comments
 (0)