src: promote verbosity to constructor arg#869
Merged
knative-prow-robot merged 5 commits intoknative:mainfrom Mar 4, 2022
Merged
src: promote verbosity to constructor arg#869knative-prow-robot merged 5 commits intoknative:mainfrom
knative-prow-robot merged 5 commits intoknative:mainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #869 +/- ##
==========================================
+ Coverage 45.18% 45.33% +0.14%
==========================================
Files 48 48
Lines 4818 4798 -20
==========================================
- Hits 2177 2175 -2
+ Misses 2342 2324 -18
Partials 299 299
Continue to review full report at Codecov.
|
eddb917 to
1e91e01
Compare
6101682 to
5645c4f
Compare
5645c4f to
efa4638
Compare
efa4638 to
d20e537
Compare
d20e537 to
edbd4c8
Compare
Contributor
|
/lgtm |
Contributor
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lkingland, zroubalik The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Contributor
|
/unhold |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
tl;dr Probably best to use either constructor args or struct member initialization and not mix. We have chosen constructors for package public API and struct members for package internal implementations. This enforces that choice with regards to the oft-ignored verbosity flag.
This rectifies a long-standing inconsistency where, early in the system's evolution all subsystems were initialized as simple structs. When we moved to using proper constructors, the Verbosity flag was left as a struct member. This is a bit confusing and awkward because it mixes constructor-based configuration with the direct setting of struct members. The former is often best for external package APIs, the latter is often best for internal. This situation straddles the line, because these packages are used by their parent package, so either way could be a defensible position.
Explicitly requiring the verbosity to be provided in the constructor is not awe-inspiring elegance, but I suppose mixing constructor-based initialization with struct members much less so. This is evidenced by how much
main's default Client constructor is simplified by requiring this flag in the constructor./kind cleanup