File tree Expand file tree Collapse file tree 1 file changed +22
-23
lines changed
pkg/commands/internal/migrate/cloner Expand file tree Collapse file tree 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) {
8585
8686 var newDecls []ast.Decl
8787 for _ , decl := range file .Decls {
88- switch d := decl .(type ) {
89- case * ast. FuncDecl :
88+ d , ok := decl .(* ast. GenDecl )
89+ if ! ok {
9090 continue
91+ }
9192
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
109101 }
110- default :
111- // noop
112- }
113102
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
115112 }
113+
114+ newDecls = append (newDecls , decl )
116115 }
117116
118117 file .Decls = newDecls
You can’t perform that action at this time.
0 commit comments