Documentation
¶
Overview ¶
Package util provides utilities for Hive libraries and services.
Package util provides utilities for Hive libraries and services.
Index ¶
Constants ¶
const DefaultServiceName = "unknown-service"
DefaultServiceName will be returned by ServiceName if no better alternative can be determined.
const Redacted = "xxxxx"
Redacted will be output in logs in place of sensitive information.
Variables ¶
This section is empty.
Functions ¶
func IsRecoveredPanicError ¶
IsRecoveredPanicError reports whether an error is a RecoveredPanicError.
func NewRecoveredPanicError ¶
NewRecoveredPanicError returns, as an error, a new RecoveredPanicError.
func ServiceName ¶
func ServiceName() string
ServiceName returns the kebab-case name of the Hive service this executable provides.
func ServiceStateDir ¶
ServiceStateDir returns the application-specific subdirectory to use for persistent state. The directory will be created if it does not exist, but is not guaranteed to be writable.
func UserStateDir ¶
UserStateDir returns the default root directory to use for user-specific state files. Users should create their own application-specific subdirectory within this one and use that.
On Unix systems, it returns $XDG_STATE_HOME as specified by https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if non-empty, else $HOME/.local/state.
If the location cannot be determined (for example, $HOME is not defined) or the path in $XDG_STATE_HOME is relative, then it will return an error.
Types ¶
type ContextKey ¶
type ContextKey struct {
// contains filtered or unexported fields
}
ContextKey is a key for use with context.Value. It's used as a pointer so it fits in an interface{} without allocation.
func NewContextKey ¶
func NewContextKey(name string) *ContextKey
func (*ContextKey) String ¶
func (k *ContextKey) String() string
type RecoveredPanicError ¶
type RecoveredPanicError interface { error RecoveredPanicError() // no-op function to distinguish from other errors. }
A panic which was recovered.