Skip to content

Commit

Permalink
ci: fix go vet errors
Browse files Browse the repository at this point in the history
```
gotip vet ./...
# github.com/netapp/harvest/v2/third_party/go-version
third_party/go-version/version.go:402:20: non-constant format string in call to fmt.Fprintf
# github.com/netapp/harvest/v2/third_party/olekukonko/tablewriter
third_party/olekukonko/tablewriter/table.go:769:24: non-constant format string in call to fmt.Fprintf
```
  • Loading branch information
cgrinds committed Nov 26, 2024
1 parent 59b1c77 commit 6866a90
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion third_party/go-version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func (v *Version) String() string {
str := strconv.FormatInt(s, 10)
fmtParts[i] = str
}
fmt.Fprintf(&buf, strings.Join(fmtParts, "."))
fmt.Fprintf(&buf, "%s", strings.Join(fmtParts, "."))
if v.pre != "" {
fmt.Fprintf(&buf, "-%s", v.pre)
}
Expand Down
32 changes: 16 additions & 16 deletions third_party/olekukonko/tablewriter/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (t *Table) SetHeader(keys []string) {

// Set table Footer
func (t *Table) SetFooter(keys []string) {
//t.colSize = len(keys)
// t.colSize = len(keys)
for i, v := range keys {
lines := t.parseDimension(v, i, footerRowIdx)
t.footers = append(t.footers, lines)
Expand Down Expand Up @@ -575,13 +575,13 @@ func (t *Table) printFooter() {
pad)
}

//fmt.Fprintf(t.out, " %s %s",
// fmt.Fprintf(t.out, " %s %s",
// padFunc(f, SPACE, v),
// pad)
}
// Next line
fmt.Fprint(t.out, t.newLine)
//t.printLine(true)
// t.printLine(true)
}

hasPrinted := false
Expand Down Expand Up @@ -702,7 +702,7 @@ func (t *Table) printRow(columns [][]string, rowIdx int) {
// columns = append(columns, []string{SPACE})
// t.cs[n] = t.mW
// }
//}
// }

// Pad Each Height
pads := []int{}
Expand All @@ -722,7 +722,7 @@ func (t *Table) printRow(columns [][]string, rowIdx int) {
columns[i] = append(columns[i], " ")
}
}
//fmt.Println(max, "\n")
// fmt.Println(max, "\n")
for x := 0; x < max; x++ {
for y := 0; y < total; y++ {

Expand Down Expand Up @@ -755,18 +755,18 @@ func (t *Table) printRow(columns [][]string, rowIdx int) {
fmt.Fprintf(t.out, "%s", PadRight(str, SPACE, t.cs[y]))

// TODO Custom alignment per column
//if max == 1 || pads[y] > 0 {
// if max == 1 || pads[y] > 0 {
// fmt.Fprintf(t.out, "%s", Pad(str, SPACE, t.cs[y]))
//} else {
// } else {
// fmt.Fprintf(t.out, "%s", PadRight(str, SPACE, t.cs[y]))
//}
// }

}
}
if !t.noWhiteSpace {
fmt.Fprintf(t.out, SPACE)
} else {
fmt.Fprintf(t.out, t.tablePadding)
fmt.Fprintf(t.out, "%s", t.tablePadding)
}
}
// Check if border is set
Expand All @@ -790,14 +790,14 @@ func (t *Table) printRowsMergeCells() {
for i, lines := range t.lines {
// We store the display of the current line in a tmp writer, as we need to know which border needs to be print above
previousLine, displayCellBorder = t.printRowMergeCells(&tmpWriter, lines, i, previousLine)
if i > 0 { //We don't need to print borders above first line
if i > 0 { // We don't need to print borders above first line
if t.rowLine {
t.printLineOptionalCellSeparators(true, displayCellBorder)
}
}
tmpWriter.WriteTo(t.out)
}
//Print the end of the table
// Print the end of the table
if t.rowLine {
t.printLine(true)
}
Expand Down Expand Up @@ -856,7 +856,7 @@ func (t *Table) printRowMergeCells(writer io.Writer, columns [][]string, rowIdx
// columnsToAutoMergeCells was not set.
mergeCell = true
}
//Store the full line to merge mutli-lines cells
// Store the full line to merge mutli-lines cells
fullLine := strings.TrimRight(strings.Join(columns[y], " "), " ")
if len(previousLine) > y && fullLine == previousLine[y] && fullLine != "" && mergeCell {
// If this cell is identical to the one above but not empty, we don't display the border and keep the cell empty.
Expand Down Expand Up @@ -892,12 +892,12 @@ func (t *Table) printRowMergeCells(writer io.Writer, columns [][]string, rowIdx
fmt.Fprint(writer, t.newLine)
}

//The new previous line is the current one
// The new previous line is the current one
previousLine = make([]string, total)
for y := 0; y < total; y++ {
previousLine[y] = strings.TrimRight(strings.Join(columns[y], " "), " ") //Store the full line for multi-lines cells
previousLine[y] = strings.TrimRight(strings.Join(columns[y], " "), " ") // Store the full line for multi-lines cells
}
//Returns the newly added line and wether or not a border should be displayed above.
// Returns the newly added line and wether or not a border should be displayed above.
return previousLine, displayCellBorder
}

Expand Down Expand Up @@ -962,6 +962,6 @@ func (t *Table) parseDimension(str string, colKey, rowKey int) []string {
if !ok || v < h || v == 0 {
t.rs[rowKey] = h
}
//fmt.Printf("Raw %+v %d\n", raw, len(raw))
// fmt.Printf("Raw %+v %d\n", raw, len(raw))
return raw
}

0 comments on commit 6866a90

Please sign in to comment.