refactor: use the built-in max/min to simplify the code

Signed-off-by: evenevent <digping@icloud.com>
This commit is contained in:
evenevent
2025-03-27 17:53:10 +08:00
committed by Martin
parent ac7e287c8e
commit 20331693f4

View File

@@ -304,7 +304,7 @@ func writeTable(w io.Writer, header []string, slice PortInfoSlice) {
padding[column] = len(header[column])
for _, row := range rows {
padding[column] = maxInt(padding[column], len(row[column]))
padding[column] = max(padding[column], len(row[column]))
}
}
@@ -322,13 +322,6 @@ func writeTable(w io.Writer, header []string, slice PortInfoSlice) {
}
}
func maxInt(a, b int) int {
if a > b {
return a
}
return b
}
func paddedRow(row []string, padding []int) []string {
out := make([]string, len(row))
for i := 0; i < len(row); i++ {