Will It Vibe logoWill It Vibe?
GO-015Low severity-4 points

errors.New wrapping fmt.Sprintf

Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 4 points from that category, once per scan, no matter how many places it turns up.

What it detects

errors.New(fmt.Sprintf(...)) does the same thing as fmt.Errorf(...) with an extra allocation and an extra import for no benefit.

Why it matters

errors.New(fmt.Sprintf(format, args...)) formats a string with Sprintf and then wraps it in a second call that does nothing but hold that already-formatted string; fmt.Errorf(format, args...) does exactly the same formatting in one call, with one fewer allocation and one fewer import to reason about. It is not a bug, just unnecessary indirection that every reader has to mentally simplify.

How to fix it

Replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) directly, passing the same format string and arguments. If the errors package is no longer used anywhere else in the file, remove its import.

The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing

Does your repo trip this check?

Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.

Scan your repo

Related Code Quality & Syntax checks