Package util implements various utility functions used within ipfs that do not currently have a better place to live.
- func ContextDo(ctx context.Context, f func() error) error
- func ContextWithErrorLog(parent context.Context) (context.Context, <-chan error)
- func ErrCast() error
- func ExpandPathnames(paths string) (string, error)
- func FileExists(filename string) bool
- func FormatRFC3339(t time.Time) string
- func GetenvBool(name string) bool
- func Hash(data byte) mh.Multihash
- func IsValidHash(s string) bool
- func LogError(ctx context.Context, err error)
- func NewSeededRand(seed int64) io.Reader
- func NewTimeSeededRand() io.Reader
- func ParseRFC3339(s string) (time.Time, error)
- func Partition(subject string, sep string) (string, string, string)
- func RPartition(subject string, sep string) (string, string, string)
- func TildeExpansion(filename string) (string, error)
- func XOR(a, b byte) byte
- type MultiErr
This section is empty.
Debug is a global flag for debugging.
ErrNotFound is returned when a search fails to find anything
ErrNotImplemented signifies a function has not been implemented yet.
ErrSeErrSearchIncomplete implies that a search type operation didnt find the expected node, but did find 'a' node.
ErrTimeout implies that a timeout has been triggered
func ContextWithErrorLog ¶
ContextWithErrorLog returns a copy of parent and an error channel that can be used to receive errors sent with the LogError method.
func ErrCast() error
ErrCast is returned when a cast fails AND the program should not panic.
func ExpandPathnames ¶
ExpandPathnames takes a set of paths and turns them into absolute paths
func GetenvBool ¶
GetenvBool is the way to check an env var as a boolean
Hash is the global IPFS hash function. uses multihash SHA2_256, 256 bits
func IsValidHash ¶
IsValidHash checks whether a given hash is valid (b58 decodable, len > 0)
LogError logs the error to the owner of the context.
If this context was created with ContextWithErrorLog, then this method passes the error to context creator over an unbuffered channel.
If this context was created by other means, this method is a no-op.
func TildeExpansion ¶
TildeExpansion expands a filename, which may begin with a tilde.
Package loggables includes a bunch of transaltor functions for commonplace/stdlib objects.
|Package loggables includes a bunch of transaltor functions for commonplace/stdlib objects.|
Package ci implements some helper functions to use during tests.
|Package ci implements some helper functions to use during tests.|
Package jenkins implements some helper functions to use during tests.
|Package jenkins implements some helper functions to use during tests.|
Package travis implements some helper functions to use during tests.
|Package travis implements some helper functions to use during tests.|