Skip to content

Commit e835014

Browse files
authored
chore: remove unused error handling code (#1685)
The `err` variable was not re-computed, ensuring that it is guaranteed to be non-nil at this point in the code.
1 parent 2f0f0ba commit e835014

File tree

2 files changed

+0
-30
lines changed

2 files changed

+0
-30
lines changed

cmd/common.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,6 @@ func syncMain(ctx context.Context, filenames []string, dry bool, parallelism,
292292
for _, c := range consumerGroupsGlobal {
293293
targetContent.ConsumerGroups = append(targetContent.ConsumerGroups,
294294
file.FConsumerGroupObject{ConsumerGroup: *c.ConsumerGroup})
295-
if err != nil {
296-
return fmt.Errorf("error adding global consumer group %v: %w", *c.ConsumerGroup.Name, err)
297-
}
298295
}
299296
}
300297

@@ -310,9 +307,6 @@ func syncMain(ctx context.Context, filenames []string, dry bool, parallelism,
310307
}
311308
for _, c := range consumersGlobal {
312309
targetContent.Consumers = append(targetContent.Consumers, file.FConsumer{Consumer: *c})
313-
if err != nil {
314-
return fmt.Errorf("error adding global consumer %v: %w", *c.Username, err)
315-
}
316310
}
317311
}
318312

@@ -328,9 +322,6 @@ func syncMain(ctx context.Context, filenames []string, dry bool, parallelism,
328322
}
329323
for _, r := range routesGlobal {
330324
targetContent.Routes = append(targetContent.Routes, file.FRoute{Route: *r})
331-
if err != nil {
332-
return fmt.Errorf("error adding global route %v: %w", r.FriendlyName(), err)
333-
}
334325
}
335326
}
336327

@@ -346,9 +337,6 @@ func syncMain(ctx context.Context, filenames []string, dry bool, parallelism,
346337
}
347338
for _, r := range servicesGlobal {
348339
targetContent.Services = append(targetContent.Services, file.FService{Service: *r})
349-
if err != nil {
350-
return fmt.Errorf("error adding global service %v: %w", r.FriendlyName(), err)
351-
}
352340
}
353341
}
354342

@@ -364,9 +352,6 @@ func syncMain(ctx context.Context, filenames []string, dry bool, parallelism,
364352
}
365353
for _, p := range partialsGlobal {
366354
targetContent.Partials = append(targetContent.Partials, file.FPartial{Partial: *p})
367-
if err != nil {
368-
return fmt.Errorf("error adding global partial %v: %w", p.FriendlyName(), err)
369-
}
370355
}
371356
}
372357

cmd/gateway_validate.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ func executeValidate(cmd *cobra.Command, _ []string) error {
7373
for _, c := range consumerGroupsGlobal {
7474
targetContent.ConsumerGroups = append(targetContent.ConsumerGroups,
7575
file.FConsumerGroupObject{ConsumerGroup: *c.ConsumerGroup})
76-
if err != nil {
77-
return fmt.Errorf("error adding global consumer group %v: %w", *c.ConsumerGroup.Name, err)
78-
}
7976
}
8077
}
8178

@@ -92,9 +89,6 @@ func executeValidate(cmd *cobra.Command, _ []string) error {
9289
}
9390
for _, c := range consumersGlobal {
9491
targetContent.Consumers = append(targetContent.Consumers, file.FConsumer{Consumer: *c})
95-
if err != nil {
96-
return fmt.Errorf("error adding global consumer %v: %w", *c.Username, err)
97-
}
9892
}
9993
}
10094

@@ -111,9 +105,6 @@ func executeValidate(cmd *cobra.Command, _ []string) error {
111105
}
112106
for _, r := range routesGlobal {
113107
targetContent.Routes = append(targetContent.Routes, file.FRoute{Route: *r})
114-
if err != nil {
115-
return fmt.Errorf("error adding global route %v: %w", r.FriendlyName(), err)
116-
}
117108
}
118109
}
119110

@@ -130,9 +121,6 @@ func executeValidate(cmd *cobra.Command, _ []string) error {
130121
}
131122
for _, r := range servicesGlobal {
132123
targetContent.Services = append(targetContent.Services, file.FService{Service: *r})
133-
if err != nil {
134-
return fmt.Errorf("error adding global service %v: %w", r.FriendlyName(), err)
135-
}
136124
}
137125
}
138126

@@ -148,9 +136,6 @@ func executeValidate(cmd *cobra.Command, _ []string) error {
148136
}
149137
for _, p := range partialsGlobal {
150138
targetContent.Partials = append(targetContent.Partials, file.FPartial{Partial: *p})
151-
if err != nil {
152-
return fmt.Errorf("error adding global partial %v: %w", p.FriendlyName(), err)
153-
}
154139
}
155140
}
156141
}

0 commit comments

Comments
 (0)