From 6e1a9fbb1e9a943e04902ed3a4958f6821e39456 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 1 Jan 2023 22:41:34 -0700 Subject: lint: Set exclude-use-default=false --- cmd/btrfs-rec/inspect_lsfiles.go | 8 ++++++-- cmd/btrfs-rec/inspect_lstrees.go | 2 +- cmd/btrfs-rec/inspect_spewitems.go | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'cmd') diff --git a/cmd/btrfs-rec/inspect_lsfiles.go b/cmd/btrfs-rec/inspect_lsfiles.go index 502d91d..395f60a 100644 --- a/cmd/btrfs-rec/inspect_lsfiles.go +++ b/cmd/btrfs-rec/inspect_lsfiles.go @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker +// Copyright (C) 2022-2023 Luke Shumaker // // SPDX-License-Identifier: GPL-2.0-or-later @@ -34,7 +34,11 @@ func init() { }, RunE: func(fs *btrfs.FS, cmd *cobra.Command, _ []string) (err error) { out := bufio.NewWriter(os.Stdout) - defer out.Flush() + defer func() { + if _err := out.Flush(); _err != nil && err == nil { + err = _err + } + }() defer func() { if r := derror.PanicToError(recover()); r != nil { textui.Fprintf(out, "\n\n%+v\n", r) diff --git a/cmd/btrfs-rec/inspect_lstrees.go b/cmd/btrfs-rec/inspect_lstrees.go index 0f70cd1..f74956a 100644 --- a/cmd/btrfs-rec/inspect_lstrees.go +++ b/cmd/btrfs-rec/inspect_lstrees.go @@ -60,7 +60,7 @@ func init() { textui.Fprintf(table, " %v items\t% *s\n", typ, numWidth, strconv.Itoa(treeItemCnt[typ])) } textui.Fprintf(table, " total items\t% *s\n", numWidth, strconv.Itoa(totalItems)) - table.Flush() + _ = table.Flush() } visitedNodes := make(containers.Set[btrfsvol.LogicalAddr]) btrfsutil.WalkAllTrees(ctx, fs, btrfsutil.WalkAllTreesHandler{ diff --git a/cmd/btrfs-rec/inspect_spewitems.go b/cmd/btrfs-rec/inspect_spewitems.go index 8d71797..3b79e8b 100644 --- a/cmd/btrfs-rec/inspect_spewitems.go +++ b/cmd/btrfs-rec/inspect_spewitems.go @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker +// Copyright (C) 2022-2023 Luke Shumaker // // SPDX-License-Identifier: GPL-2.0-or-later @@ -39,13 +39,13 @@ func init() { Item: func(path btrfstree.TreePath, item btrfstree.Item) error { textui.Fprintf(os.Stdout, "%s = ", path) spew.Dump(item) - os.Stdout.WriteString("\n") + _, _ = os.Stdout.WriteString("\n") return nil }, BadItem: func(path btrfstree.TreePath, item btrfstree.Item) error { textui.Fprintf(os.Stdout, "%s = ", path) spew.Dump(item) - os.Stdout.WriteString("\n") + _, _ = os.Stdout.WriteString("\n") return nil }, }, -- cgit v1.2.3-2-g168b