- Conversions from/to
[]byteto/from various types. - Various bytes operations.
HexByte:[]bytealias withMarshalJSONandUnmarshalJSONmethods for hex encoding.
Error-related utilities.
ReadFromWriter is the interface that groups the basic ReadFrom and Write methods.
ReadFromWriteCloser is the interface that groups the basic ReadFrom, Write and Close methods.
WriteToReader is the interface that groups the basic WriteTo and Read methods.
WriteToReadCloser is the interface that groups the basic WriteTo, Read and Close methods.
ReaderFromWriter is a type that wraps an io.ReaderFrom and implements ReadFromWriteCloser using io.Pipe.
Due to the asynchronous nature of io.Pipe, Write() will only be guaranteed to be visible after
a call to Sync() or Close().
WriterToReader is a type that wraps an io.WriterTo implementation and implements WriteToReadCloser using io.Pipe.
ReadFromWriteToReadWriteCloser is the interface that groups the basic WriteTo, ReadFrom, Read, Write and Close methods.
ReaderFromWriteToReadWriteCloser is a type that wraps an io.ReaderFrom and a io.WriterTo, and
implements io.ReadWriteCloser, ReadFromWriteCloser and WriteToReadCloser using io.Pipe.
Due to the asynchronous nature of io.Pipe, Write() will only be guaranteed to be visible after
a call to Sync() or Close().
Connect dials the given address and returns a net.Conn. The protoAddr argument should be prefixed with the protocol, eg. "tcp://127.0.0.1:8080" or "unix:///tmp/test.sock"
ProtocolAndAddress splits an address into the protocol and address components. For instance, "tcp://127.0.0.1:8080" will be split into "tcp" and "127.0.0.1:8080". If the address has no protocol prefix, the default is "tcp".
GetFreePort gets a free port from the operating system.
TrapSignal catches SIGTERM and SIGINT, executes the cleanup function, and exits with code 0.
Exit prints string s then os.Exit(1).
EnsureDir ensures the given directory exists, creating it if necessary. Errors if the path already exists as a non-directory.
CopyFile copies a file. It truncates the destination file if it exists.
GetMACInterface returns the network interface associated with the MAC address of the host machine.
GetMACStr returns the MAC address of the host machine.
GetMACStr returns the MAC address of the host machine represented in uint64.
Random number, string, bytes generation.
Package service/goprocesssrv is a service implementation based on goprocess that supports declaring and ensuring runtime dependencies between services.
Package service/suturesrv is a service implementation based on Suture.
Use sync.Mutex and sync.RWMutex from this package instead of sync so you can build your
program with deadlock flag to detect deadlocks
using go-deadklock.
ResultNotifier can be used for a goroutine to notify others that a job is done and pass the error
occurred or nil if no error. It's based on sync.Cond.
Default license for the code in this library is MIT, see the source code for exceptions.