ignore

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: BSD-3-Clause Imports: 2 Imported by: 11

README

ignore

Ignore unimportant error values

Go Report Card Build Status GoDoc NetflixOSS Lifecycle GitHub

Project Overview

Module gophers.dev/pkgs/ignore provides a package with functions for ignoring unimportant error values. These are useful for indicating errors that do not matter, while also getting your IDE to stop highlighting ignored error returns.

Getting Started

The ignore package can be installed by running

go get gophers.dev/pkgs/ignore
Example Usage of ignore
// Close, the old way
// _ = closer.Close()

// Close, the new way
ignore.Close(closer)

// Drain, the old way
// _, _ = io.Copy(io.Discard, reader)
// _ = reader.Close()

// Drain, the new way
ignore.Drain(reader)

Contributing

The gophers.dev/pkgs/ignore module is always improving with new features and error corrections. For contributing bug fixes and new features please file an issue.

License

The gophers.dev/pkgs/ignore module is open source under the BSD-3-Clause license.

Documentation

Overview

Package ignore is used to ignore unimportant errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(c io.Closer)

Close c and ignore the error.

func Drain

func Drain(rc io.ReadCloser)

Drain rc and Close it, ignoring any error.

func Error added in v0.3.0

func Error(_ error)

Error will ignore the error

func Panic added in v0.3.1

func Panic(err error)

Panic will cause a panic if the error is not nil.

Intended to pave over cases where an error "cannot" happen. e.g. JSON decoding a string literal - if an error occurs, something is seriously broken and the program may as well halt.

func Rollback

func Rollback(r Rollbacker)

Rollback r and ignore the error.

Types

type Rollbacker

type Rollbacker interface {
	Rollback() error
}

A Rollbacker implements the Rollback method.

Jump to

Keyboard shortcuts

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