Package Usage: go: gopkg.in/warnings.v0
Package warnings implements error handling with non-fatal errors (warnings).
A recurring pattern in Go programming is the following:
This pattern allows interrupting the flow on any received error. But what if
there are errors that should be noted but still not fatal, for which the flow
should not be interrupted? Implementing such logic at each if statement would
make the code complex and the flow much harder to follow.
Package warnings provides the Collector type and a clean and simple pattern
for achieving such logic. The Collector takes care of deciding when to break
the flow and when to continue, collecting any non-fatal errors (warnings)
along the way. The only requirement is that fatal and non-fatal errors can be
distinguished programmatically; that is a function such as
must be implemented. The following is an example of what the above snippet
could look like using the warnings package:
For an example of a non-trivial code base using this library, see
gopkg.in/gcfg.v1
Rules for using warnings
TODO
3 versions
Latest release: over 7 years ago
6,987 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/gopkg.in/warnings.v0
Dependent Repos 4

