Skip to content

Conversation

mauri870
Copy link
Member

@mauri870 mauri870 commented Aug 11, 2025

What does this PR do?

Currently, misuse of printf directives in logger functions is not reported by go vet. Use a small trick to enable the x/tools/go/analysis/passes/printf analyzer on printf wrappers, allowing this check to catch format string issues.

See https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/printf#hdr-Inferred_printf_wrappers

Why is it important?

Reports misuse of printing directives in the logger functions.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works

Currently, misuse of printf directives in logger functions is not
reported by go vet. Use a small trick to enable the
x/tools/go/analysis/passes/printf analyzer on printf wrappers,
allowing this check to catch format string issues.
@mauri870 mauri870 requested a review from a team as a code owner August 11, 2025 15:26
@mauri870 mauri870 requested review from AndersonQ and rdner and removed request for a team August 11, 2025 15:26
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

@mauri870 mauri870 merged commit e412635 into elastic:main Aug 12, 2025
5 checks passed
@mauri870 mauri870 self-assigned this Aug 12, 2025
@mauri870 mauri870 added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Aug 12, 2025
@andrewkroh
Copy link
Member

Very nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants