Skip to content

Simplify a negated comparison and an mtree escape write - #383

Merged
folbricht merged 1 commit into
masterfrom
lint-tar-mtreefs-quickfix
Aug 4, 2026
Merged

Simplify a negated comparison and an mtree escape write#383
folbricht merged 1 commit into
masterfrom
lint-tar-mtreefs-quickfix

Conversation

@folbricht

Copy link
Copy Markdown
Owner

Two staticcheck quickfix suggestions, both no-ops behaviourally:

  • tar.go:108 (QF1001) — !(path.Dir(f.Path) == dir) reads better as path.Dir(f.Path) != dir.
  • mtreefs.go:106 (QF1012) — mtreeFilename() built each escape sequence as a temporary string via fmt.Sprintf before appending it. strings.Builder is an io.Writer, so format straight into it with fmt.Fprintf and skip the intermediate allocation.

The remaining QF findings are the opt.cmdStoreOptions.validate() embedded-field selectors (QF1008), one QF1006 in fileseed.go and one QF1001 in tar.go:54, all left alone as the current spelling is clearer.

tar.go compared with !(a == b) where a != b says the same thing.

mtreeFilename built each escape sequence as a temporary string before
appending it. strings.Builder is an io.Writer, so format straight into
it instead.
@folbricht
folbricht merged commit 49354c2 into master Aug 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant