@@ -130,7 +130,7 @@ func parseAPIDef() ([]*Function, []*Function, error) {
130
130
}
131
131
132
132
var functions []* Function
133
- var deprecateds []* Function
133
+ var deprecated []* Function
134
134
135
135
for _ , decl := range file .Decls {
136
136
fdecl , ok := decl .(* ast.FuncDecl )
@@ -191,13 +191,13 @@ func parseAPIDef() ([]*Function, []*Function, error) {
191
191
}
192
192
193
193
if m .DeprecatedSince > 0 {
194
- deprecateds = append (deprecateds , m )
194
+ deprecated = append (deprecated , m )
195
195
continue
196
196
}
197
197
functions = append (functions , m )
198
198
}
199
199
200
- return functions , deprecateds , nil
200
+ return functions , deprecated , nil
201
201
}
202
202
203
203
const genTemplate = `
@@ -622,27 +622,30 @@ func main() {
622
622
return
623
623
}
624
624
625
- functions , deprecateds , err := parseAPIDef ()
625
+ functions , deprecated , err := parseAPIDef ()
626
626
if err != nil {
627
627
log .Fatal (err )
628
628
}
629
629
630
630
switch {
631
631
case * compareFlag :
632
- functions = append (functions , deprecateds ... )
633
- err = compareFunctions (functions )
634
- default :
635
- if * generateFlag != "" {
636
- if * deprecatedFlag == "" {
637
- functions = append (functions , deprecateds ... )
638
- }
639
- err = printImplementation (functions , implementationTemplate , * generateFlag )
632
+ functions = append (functions , deprecated ... )
633
+ if err := compareFunctions (functions ); err != nil {
634
+ log .Fatal (err )
635
+ }
636
+
637
+ case * generateFlag != "" :
638
+ if * deprecatedFlag == "" {
639
+ functions = append (functions , deprecated ... )
640
+ }
641
+ if err := printImplementation (functions , implementationTemplate , * generateFlag ); err != nil {
642
+ log .Fatal (err )
640
643
}
644
+
641
645
if * deprecatedFlag != "" {
642
- err = printImplementation (deprecateds , deprecatedTemplate , * deprecatedFlag )
646
+ if err := printImplementation (deprecated , deprecatedTemplate , * deprecatedFlag ); err != nil {
647
+ log .Fatal (err )
648
+ }
643
649
}
644
650
}
645
- if err != nil {
646
- log .Fatal (err )
647
- }
648
651
}
0 commit comments