@@ -76,18 +76,18 @@ func DisplayTable(out any, sort string, filterColumns []string) (string, error)
76
76
if v .Kind () != reflect .Slice {
77
77
return "" , xerrors .Errorf ("DisplayTable called with a non-slice type" )
78
78
}
79
- var fst reflect.Type
79
+ var tableType reflect.Type
80
80
if v .Type ().Elem ().Kind () == reflect .Interface {
81
81
if v .Len () == 0 {
82
82
return "" , xerrors .Errorf ("DisplayTable called with empty interface slice" )
83
83
}
84
- fst = reflect .Indirect (reflect .ValueOf (v .Index (0 ).Interface ())).Type ()
84
+ tableType = reflect .Indirect (reflect .ValueOf (v .Index (0 ).Interface ())).Type ()
85
85
} else {
86
- fst = v .Type ().Elem ()
86
+ tableType = v .Type ().Elem ()
87
87
}
88
88
89
89
// Get the list of table column headers.
90
- headersRaw , defaultSort , err := typeToTableHeaders (fst , true )
90
+ headersRaw , defaultSort , err := typeToTableHeaders (tableType , true )
91
91
if err != nil {
92
92
return "" , xerrors .Errorf ("get table headers recursively for type %q: %w" , v .Type ().Elem ().String (), err )
93
93
}
@@ -142,10 +142,10 @@ func DisplayTable(out any, sort string, filterColumns []string) (string, error)
142
142
return "" , xerrors .Errorf ("specified sort column %q not found in table headers, available columns are %q" , sort , strings .Join (headersRaw , `", "` ))
143
143
}
144
144
}
145
- return doDisplayTable (out , sort , headersRaw , filterColumns )
145
+ return renderTable (out , sort , headersRaw , filterColumns )
146
146
}
147
147
148
- func doDisplayTable (out any , sort string , headersRaw []string , filterColumns []string ) (string , error ) {
148
+ func renderTable (out any , sort string , headersRaw []string , filterColumns []string ) (string , error ) {
149
149
v := reflect .Indirect (reflect .ValueOf (out ))
150
150
151
151
headers := make (table.Row , len (headersRaw ))
0 commit comments