Intermediate Go (Golang)
Q71 / 100

What is a sentinel error in Go?

Correct! Well done.

Incorrect.

The correct answer is B) A package-level error variable used for comparison: var ErrNotFound = errors.New("not found")

B

Correct Answer

A package-level error variable used for comparison: var ErrNotFound = errors.New("not found")

Explanation

Sentinel errors allow callers to check err == io.EOF. With error wrapping, use errors.Is(err, io.EOF) to check the chain.

Progress
71/100