fmtErrorf
fmtErrorf is a function in the Go programming language that formats an error message and returns it as an error value. It is part of the standard library package fmt, which provides I/O formatting primitives. The function signature is:
func Errorf(format string, a ...interface{}) error
The format string works with the same verbs and flags as fmt.Printf. Each verb may be preceded
Typical usage is to create simple descriptive errors that contain variable information. For example:
err := fmt.Errorf("read %d bytes: %w", n, io.ErrUnexpectedEOF)
Here the %w verb is used to wrap an existing error, enabling error unwrapping with errors.Is and
Compared to constructing errors with errors.New, fmtErrorf provides automatic string formatting, useful for complex messages or