Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CheckClose ¶
CheckClose is used with defer to close the given io.Closer and check its returned error value. If Close returns an error and the given *error is not nil, *error is set to the error returned by Close.
CheckClose is typically used with named return values like so:
func do(obj *Object) (err error) { w, err := obj.Writer() if err != nil { return nil } defer CheckClose(w, &err) // work with w }
func NewReadCloser ¶
NewReadCloser creates an `io.ReadCloser` with the given `io.Reader` and `io.Closer`.
func NonEmptyReader ¶
NonEmptyReader takes a reader and returns it if it is not empty, or `ErrEmptyReader` if it is empty. If there is an error when reading the first byte of the given reader, it will be propagated.
func WriteNopCloser ¶
func WriteNopCloser(w io.Writer) io.WriteCloser
WriteNopCloser returns a WriteCloser with a no-op Close method wrapping the provided Writer w.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.