util

package
v0.0.0-...-8223eb1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 10 Imported by: 57

README

Go Language Utilities

Sparingly added utilities. New things in here should be thoughtful. Reflection utilities / AOP / other magic will be judged appropriately.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

func Errorf(format string, a ...interface{}) error

Errorf formats according to fmt.Errorf, but prefixes the error message with filename and line number.

func IsPodIntallationError

func IsPodIntallationError(err error) bool

func LoadTokens

func LoadTokens(path string) ([]string, error)

func MkdirChownAll

func MkdirChownAll(path string, uid, gid int, perm os.FileMode) error

func Stack

func Stack() []byte

Stack formats the stack trace of the calling goroutine.

func WriteIfChanged

func WriteIfChanged(filename string, data []byte, perm os.FileMode) (bool, error)

Types

type Caller

type Caller struct {
	Filename string
}

func From

func From(pc uintptr, file string, line int, ok bool) *Caller

Get a caller object. This is intented to be passed runtime.Caller() from the target

func (*Caller) Dirname

func (c *Caller) Dirname() string

func (*Caller) ExpandPath

func (c *Caller) ExpandPath(pathstr string) string

func (*Caller) Glob

func (c *Caller) Glob(pattern string) ([]string, error)

type CallsiteError

type CallsiteError interface {
	error
	LineNumber() int
	Filename() string
	Function() string
}

type FileWatcher

type FileWatcher struct {
	// contains filtered or unexported fields
}

A FileWatcher caches data that is parsed from a file. Requests for the file's data are serialized through the FileWatcher. When the data are needed, if the file has changed since the last time it was read (determined by examining mtime), it will be re-loaded before returning the data.

func NewFileWatcher

func NewFileWatcher(
	parse func(path string) (interface{}, error),
	path string,
) (FileWatcher, error)

func (FileWatcher) Close

func (w FileWatcher) Close()

func (FileWatcher) GetAsync

func (w FileWatcher) GetAsync() <-chan interface{}

type PodIntallationError

type PodIntallationError struct {
	Inner error
	PodID types.PodID
}

func (PodIntallationError) Error

func (r PodIntallationError) Error() string

type StackError

type StackError interface {
	CallsiteError
	Stack() []byte
}

StackError represents an error with an associated stack trace.

Directories

Path Synopsis
net
The param package is a management system for configuration parameters.
The param package is a management system for configuration parameters.
Package size provides a converter between a string representation of a size and a number of bytes, and reverse.
Package size provides a converter between a string representation of a size and a number of bytes, and reverse.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL