Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chunked format string issues? #1955

Closed
mtrmac opened this issue Jun 7, 2024 · 1 comment · Fixed by #1960
Closed

chunked format string issues? #1955

mtrmac opened this issue Jun 7, 2024 · 1 comment · Fixed by #1960

Comments

@mtrmac
Copy link
Collaborator

mtrmac commented Jun 7, 2024

Per GOOS=linux golangci-lint run --no-config ./...:

pkg/chunked/dump/dump.go:154:15: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
	if _, err := fmt.Fprintf(out, escapedOptional(payload, ESCAPE_LONE_DASH)); err != nil {
	             ^
pkg/chunked/dump/dump.go:168:15: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
	if _, err := fmt.Fprintf(out, escapedOptional(digest, ESCAPE_LONE_DASH)); err != nil {

and there may be more. Shouldn’t this use Fprintf("%s"), or some kind of Write, so that % characters are not interpreted?

Cc: @giuseppe

[One of these days I’m going to make a non-consensus decision on #1579 …]

giuseppe added a commit to giuseppe/storage that referenced this issue Jun 7, 2024
replace Fprintf(file, string) with Fprint(file, string) since
the argument is a raw string and it should not be treated as a
formatting directive.

Closes: containers#1955

Signed-off-by: Giuseppe Scrivano <[email protected]>
@giuseppe
Copy link
Member

giuseppe commented Jun 7, 2024

it was just a too aggressive copy&paste. Thanks for reporting it:

I think it is a good idea to enable more linters

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 a pull request may close this issue.

2 participants