safe

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(ctx context.Context, closer io.Closer)

Close safely closes an io.Closer and reports any error via errutil.Handle. It handles nil closers gracefully.

func CloseExcept added in v0.3.0

func CloseExcept(ctx context.Context, closer io.Closer, ignore ...error)

CloseExcept closes an io.Closer and reports the error via errutil.Handle unless it matches one of the given sentinels. It exists because some Close implementations use a sentinel to signal a normal shutdown — BigQuery's managedwriter returns io.EOF from Close on a healthy stream — and reporting that as an error buries real failures under per-call noise. Pass no sentinels to get the plain Close behaviour. It handles nil closers gracefully.

func Copy

func Copy(ctx context.Context, dst io.Writer, src io.Reader)

Copy safely copies data from src to dst and reports any error via errutil.Handle.

func Write

func Write(ctx context.Context, w io.Writer, data []byte)

Write safely writes data to an io.Writer and reports any error via errutil.Handle. It handles nil writers gracefully.

Types

This section is empty.

Jump to

Keyboard shortcuts

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