summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-12-24 23:55:03 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2022-12-26 23:55:42 -0700
commit74bb10779338bbb06be44a523d1e166b760018f7 (patch)
tree3475918a6fbbdb4a42ea379b87d883132e33c7d1 /cmd
parenta90e25a1298602c30d0b9cc0c86acede7c8e4ed4 (diff)
tree-wide: Audit for fmt.Fprint usage, in favor of textui
Diffstat (limited to 'cmd')
-rw-r--r--cmd/btrfs-rec/inspect_lstrees.go7
-rw-r--r--cmd/btrfs-rec/main.go4
2 files changed, 5 insertions, 6 deletions
diff --git a/cmd/btrfs-rec/inspect_lstrees.go b/cmd/btrfs-rec/inspect_lstrees.go
index e0dc4e1..7f59eaa 100644
--- a/cmd/btrfs-rec/inspect_lstrees.go
+++ b/cmd/btrfs-rec/inspect_lstrees.go
@@ -6,7 +6,6 @@ package main
import (
"encoding/json"
- "fmt"
"os"
"strconv"
"text/tabwriter"
@@ -58,11 +57,11 @@ func init() {
numWidth := len(strconv.Itoa(slices.Max(treeErrCnt, totalItems)))
table := tabwriter.NewWriter(os.Stdout, 0, 8, 2, ' ', 0)
- fmt.Fprintf(table, " errors\t% *s\n", numWidth, strconv.Itoa(treeErrCnt))
+ textui.Fprintf(table, " errors\t% *s\n", numWidth, strconv.Itoa(treeErrCnt))
for _, typ := range maps.SortedKeys(treeItemCnt) {
- fmt.Fprintf(table, " %v items\t% *s\n", typ, numWidth, strconv.Itoa(treeItemCnt[typ]))
+ textui.Fprintf(table, " %v items\t% *s\n", typ, numWidth, strconv.Itoa(treeItemCnt[typ]))
}
- fmt.Fprintf(table, " total items\t% *s\n", numWidth, strconv.Itoa(totalItems))
+ textui.Fprintf(table, " total items\t% *s\n", numWidth, strconv.Itoa(totalItems))
table.Flush()
}
visitedNodes := make(containers.Set[btrfsvol.LogicalAddr])
diff --git a/cmd/btrfs-rec/main.go b/cmd/btrfs-rec/main.go
index c808237..a221cb7 100644
--- a/cmd/btrfs-rec/main.go
+++ b/cmd/btrfs-rec/main.go
@@ -7,7 +7,6 @@ package main
import (
"context"
"encoding/json"
- "fmt"
"os"
"github.com/datawire/dlib/dgroup"
@@ -20,6 +19,7 @@ import (
"git.lukeshu.com/btrfs-progs-ng/lib/btrfs"
"git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsvol"
"git.lukeshu.com/btrfs-progs-ng/lib/btrfsprogs/btrfsutil"
+ "git.lukeshu.com/btrfs-progs-ng/lib/textui"
)
type logLevelFlag struct {
@@ -162,7 +162,7 @@ func main() {
}
if err := argparser.ExecuteContext(context.Background()); err != nil {
- fmt.Fprintf(os.Stderr, "%v: error: %v\n", argparser.CommandPath(), err)
+ textui.Fprintf(os.Stderr, "%v: error: %v\n", argparser.CommandPath(), err)
os.Exit(1)
}
}