File tree 1 file changed +22
-23
lines changed
pkg/commands/internal/migrate/cloner
1 file changed +22
-23
lines changed Original file line number Diff line number Diff line change @@ -85,34 +85,33 @@ func processFile(file *ast.File) {
85
85
86
86
var newDecls []ast.Decl
87
87
for _ , decl := range file .Decls {
88
- switch d := decl .(type ) {
89
- case * ast. FuncDecl :
88
+ d , ok := decl .(* ast. GenDecl )
89
+ if ! ok {
90
90
continue
91
+ }
91
92
92
- case * ast.GenDecl :
93
- switch d .Tok {
94
- case token .CONST , token .VAR :
95
- continue
96
- case token .TYPE :
97
- for _ , spec := range d .Specs {
98
- typeSpec , ok := spec .(* ast.TypeSpec )
99
- if ! ok {
100
- continue
101
- }
102
-
103
- structType , ok := typeSpec .Type .(* ast.StructType )
104
- if ! ok {
105
- continue
106
- }
107
-
108
- processStructFields (structType )
93
+ switch d .Tok {
94
+ case token .CONST , token .VAR :
95
+ continue
96
+ case token .TYPE :
97
+ for _ , spec := range d .Specs {
98
+ typeSpec , ok := spec .(* ast.TypeSpec )
99
+ if ! ok {
100
+ continue
109
101
}
110
- default :
111
- // noop
112
- }
113
102
114
- newDecls = append (newDecls , decl )
103
+ structType , ok := typeSpec .Type .(* ast.StructType )
104
+ if ! ok {
105
+ continue
106
+ }
107
+
108
+ processStructFields (structType )
109
+ }
110
+ default :
111
+ // noop
115
112
}
113
+
114
+ newDecls = append (newDecls , decl )
116
115
}
117
116
118
117
file .Decls = newDecls
You can’t perform that action at this time.
0 commit comments