diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-11 22:30:35 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-11 22:38:48 -0600 |
commit | 6fc5d416a289235dd4bb56d29fb96c5a003ea89f (patch) | |
tree | e35bb16c46c2ad8d8563b42e12a1e95cbd936dc7 /cmd | |
parent | f1a212cddb8dc051c510327c365da42e30b23ab9 (diff) |
use %v when possible
Exceptions are
- the occasional %x when the type is a basic int
- %w
- %q
- %T
- whenever print_tree.go needs to be dumb for compatibility with C
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/btrfs-dbg/main.go | 4 | ||||
-rw-r--r-- | cmd/btrfs-dump-tree/main.go | 10 | ||||
-rw-r--r-- | cmd/btrfs-fsck/main.go | 2 | ||||
-rw-r--r-- | cmd/btrfs-fsck/pass1.go | 10 |
4 files changed, 13 insertions, 13 deletions
diff --git a/cmd/btrfs-dbg/main.go b/cmd/btrfs-dbg/main.go index 9536126..62b005c 100644 --- a/cmd/btrfs-dbg/main.go +++ b/cmd/btrfs-dbg/main.go @@ -13,7 +13,7 @@ import ( func main() { if err := Main(os.Args[1]); err != nil { - fmt.Fprintf(os.Stderr, "%s: error: %v\n", os.Args[0], err) + fmt.Fprintf(os.Stderr, "%v: error: %v\n", os.Args[0], err) os.Exit(1) } } @@ -65,7 +65,7 @@ func Main(imgfilename string) (err error) { if err != nil { fmt.Println(err) } else { - fmt.Printf("node@%d: physical_addr=0x%0X logical_addr=0x%0X generation=%d owner=%v level=%d\n", + fmt.Printf("node@%v: physical_addr=%v logical_addr=%v generation=%v owner=%v level=%v\n", nodeRef.Addr, nodeRef.Addr, nodeRef.Data.Head.Addr, nodeRef.Data.Head.Generation, nodeRef.Data.Head.Owner, nodeRef.Data.Head.Level) diff --git a/cmd/btrfs-dump-tree/main.go b/cmd/btrfs-dump-tree/main.go index 5df5468..ad3f126 100644 --- a/cmd/btrfs-dump-tree/main.go +++ b/cmd/btrfs-dump-tree/main.go @@ -11,7 +11,7 @@ import ( func main() { if err := Main(os.Args[1]); err != nil { - fmt.Fprintf(os.Stderr, "%s: error: %v\n", os.Args[0], err) + fmt.Fprintf(os.Stderr, "%v: error: %v\n", os.Args[0], err) os.Exit(1) } } @@ -49,7 +49,7 @@ func Main(imgfilename string) (err error) { return err } - fmt.Printf("btrfs-progs v%s \n", version) + fmt.Printf("btrfs-progs v%v \n", version) if superblock.Data.RootTree != 0 { fmt.Printf("root tree\n") if err := btrfsmisc.PrintTree(fs, superblock.Data.RootTree); err != nil { @@ -102,14 +102,14 @@ func Main(imgfilename string) (err error) { if !ok { treeName = "file" } - fmt.Printf("%s tree %s \n", treeName, btrfsmisc.FmtKey(key)) + fmt.Printf("%v tree %v \n", treeName, btrfsmisc.FmtKey(key)) return btrfsmisc.PrintTree(fs, body.(btrfsitem.Root).ByteNr) }, }); err != nil { return err } - fmt.Printf("total bytes %d\n", superblock.Data.TotalBytes) - fmt.Printf("bytes used %d\n", superblock.Data.BytesUsed) + fmt.Printf("total bytes %v\n", superblock.Data.TotalBytes) + fmt.Printf("bytes used %v\n", superblock.Data.BytesUsed) fmt.Printf("uuid %v\n", superblock.Data.FSUUID) return nil diff --git a/cmd/btrfs-fsck/main.go b/cmd/btrfs-fsck/main.go index 7ab5a44..c4bfc75 100644 --- a/cmd/btrfs-fsck/main.go +++ b/cmd/btrfs-fsck/main.go @@ -9,7 +9,7 @@ import ( func main() { if err := Main(os.Args[1]); err != nil { - fmt.Fprintf(os.Stderr, "%s: error: %v\n", os.Args[0], err) + fmt.Fprintf(os.Stderr, "%v: error: %v\n", os.Args[0], err) os.Exit(1) } } diff --git a/cmd/btrfs-fsck/pass1.go b/cmd/btrfs-fsck/pass1.go index cf93b1b..37fca0c 100644 --- a/cmd/btrfs-fsck/pass1.go +++ b/cmd/btrfs-fsck/pass1.go @@ -149,11 +149,11 @@ func pass1ScanOneDev_x( } chunk, ok := item.Body.(btrfsitem.Chunk) if !ok { - fmt.Printf("Pass 1: ... dev[%q] node@%d: item %d: error: type is CHUNK_ITEM_KEY, but struct is %T\n", + fmt.Printf("Pass 1: ... dev[%q] node@%v: item %v: error: type is CHUNK_ITEM_KEY, but struct is %T\n", dev.Name(), nodeRef.Addr, i, item.Body) continue } - fmt.Printf("Pass 1: ... dev[%q] node@%d: item %d: found chunk\n", + fmt.Printf("Pass 1: ... dev[%q] node@%v: item %v: found chunk\n", dev.Name(), nodeRef.Addr, i) lostAndFoundChunks = append(lostAndFoundChunks, btrfs.SysChunk{ Key: item.Head.Key, @@ -164,7 +164,7 @@ func pass1ScanOneDev_x( }, func(pos btrfs.PhysicalAddr) { pct := int(100 * float64(pos) / float64(devSize)) if pct != lastProgress || pos == devSize { - fmt.Printf("Pass 1: ... dev[%q] scanned %v%% (found %d nodes)\n", + fmt.Printf("Pass 1: ... dev[%q] scanned %v%% (found %v nodes)\n", dev.Name(), pct, len(foundNodes)) lastProgress = pct } @@ -311,8 +311,8 @@ func pass1WriteReconstructedChunks( for i, laddr := range sortedLAddrs { chunk := fsReconstructedChunks[laddr] for j, stripe := range chunk.Stripes { - fmt.Printf("Pass 1: chunks[%d].stripes[%d] = { laddr=0x%0x => { dev_id=%d, paddr=0x%0x }, size=0x%0x }\n", - i, j, laddr, stripe.DeviceID, stripe.Offset, chunk.Size) + fmt.Printf("Pass 1: chunks[%v].stripes[%v] = { laddr=%v => { dev_id=%v, paddr=%v }, size=%v }\n", + i, j, laddr, stripe.DeviceID, stripe.Offset, btrfs.LogicalAddr(chunk.Size)) } reconstructedNode.Data.BodyLeaf = append(reconstructedNode.Data.BodyLeaf, btrfs.Item{ Head: btrfs.ItemHeader{ |