forked from protocolbuffers/txtpbfmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parser: swap all log.Errorf calls with error values
As I was working on my patch for protocolbuffers#70, I was wondering if we really needed a logger interface with both Infof and Errorf. After all, a library should report its errors as values, not via a logger. Turns out it's relatively straightforward to do so. All functions that used to call log.Errorf are themselves called from top-level APIs which are able to return an error, so we just need to thread them. One special case is getMetaCommentStringValues, which used to report each error and continue rather than stop. We currently do not have an idiomatic way to report multiple errors at once, so return the first error for now. In the future, we could use https://go.dev/issue/53435. Updates protocolbuffers#70.
- Loading branch information
Showing
1 changed file
with
37 additions
and
25 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