- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5" - Update version.txt from 4.29 → .30 (automated by Makefile)
1.5 KiB
obidefault Package — Semantic Overview
This minimal Go package provides a centralized, mutable global flag for controlling warning verbosity across an application.
Core Functionality
-
__silent_warning__:
A package-level boolean variable (unexported) that determines whether warnings should be suppressed. -
SilentWarning() bool:
A read-only accessor returning the current state of__silent_warning__. Enables safe, non-mutating checks elsewhere in the codebase. -
SilentWarningPtr() *bool:
Returns a pointer to__silent_warning__, allowing external code (e.g., CLI parsers, config loaders) to directly mutate the flag — e.g.,*SilentWarningPtr() = true.
Design Intent
-
Simplicity & Centralization:
Avoids scattering warning-control logic; provides a single source of truth. -
Flexibility:
Supports both read-only inspection (viaSilentWarning()) and global mutation (via pointer), useful for early initialization phases. -
Explicit Semantics:
WhenSilentWarning()returnstrue, all warning-generating code should suppress output (implementation responsibility lies outside this package).
Usage Example
// Suppress warnings globally:
*obidefault.SilentWarningPtr() = true
if !obidefault.SilentWarning() {
log.Println("⚠️ Warning: something happened")
}
Note
: The double underscore prefix on
__silent_warning__signals internal/private status, discouraging direct access.