-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
48040: *: lint log and error formatters / constructors r=irfansharif,ajwerner,RaduBerinde a=knz This patch adds a new `fmtsafe` linter in the roachvet tree and fixes a couple of bugs found by the litter. The linter checks the following: - that the format string in `log.Infof()`, `errors.Errorf()` and similar calls is a constant string. This check is essential for correctness because format strings are assumed to be PII-free and always safe for reporting in telemetry or PII-free logs. - that the message strings in errors.New() and similar calls that construct error objects is a constant string. This check is provided to encourage hygiene: errors constructed using non-constant strings are better constructed using a formatting function instead, which makes the construction more readable and encourage the provision of PII-free reportable details. New error or logging formatter should be subsequently added to the file `functions.go` in that linter's directory. It is possible for a call site to opt the format/message string out of the linter using `/* nolint:fmtsafe */` after the format argument. This can only be done in tests, where it can be assumed that no formatted messages/errors will ever be reported to telemetry. Example bugs that were found: - `log.Warningf(ctx, msg)` with a non-constant `msg` that might contain `%` codes. - calls to `errors.New(fmt.Sprintf(...))` instead of `errors.Newf(...)`. Release note: None 48113: colexec: fix TestRouterOutputAddBatch when BatchSize=3 r=yuzefovich a=asubiotto The QuarterSelection test would use BatchSize/4 elements and expect a spill to disk. With BatchSize=3, the number of elements would be 0, causing the test to fail since no disk spill occurred. Release note: None (testing fix). Fixes #48088 Co-authored-by: Raphael 'kena' Poss <[email protected]> Co-authored-by: Alfonso Subiotto Marques <[email protected]>
- Loading branch information
Showing
55 changed files
with
796 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.