feat: VerboseError + click-jumpable error format - #11
Merged
Conversation
Introduce CallError and IdentifierError carrying types.Signature and types.Type so consumers can render multi-line diagnostics that include the full function signature, the navigated type, and — for named types — the original source declaration with its godoc. Existing Error() output is preserved; the new path activates via FormatVerbose, which the CLI now uses. Also: - unify *Error formatting so newError and wrapError both produce the location prefix (previously only newError did) - fix checkCallArguments returning the parameter type instead of the function's result on the pointer-deref fallback - fix copy-paste "built-in eq..." messages on and/or and comparison builtins, off-by-one in slice arg-count message, and panics on empty argTypes for len/slice/index Assisted-by: Claude:claude-opus-4-7 gopls staticcheck
…line:col Errors now begin directly with the location, matching the convention gopls and the Go compiler use. Terminals and IDEs treat the leading file:line:col as a clickable jump-to-source target. The remainder of the line keeps the same shape produced by text/template at runtime (executing %q at <ctx>: msg), which also simplifies the runtime-error comparison helper in check_test.go. Updated affected EqualError/ErrorContains/Output assertions and scripttest patterns. Assisted-by: Claude:claude-opus-4-7 gopls staticcheck
Templates only ever look up fields or methods through .Foo chains, so making that explicit in the error message clarifies what the resolver was attempting and matches Go's own diagnostic phrasing. Assisted-by: Claude:claude-opus-4-7 gopls staticcheck
crhntr
force-pushed
the
bump/tools-to-v0.44.0
branch
from
May 7, 2026 05:23
adbf64f to
9040db5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VerboseError(a new error interface) plusCallErrorandIdentifierErrorcarrying*types.Signature/types.Typeso consumers can render multi-line diagnostics that include the full function signature, the navigated type, and — for named types — the original Go source declaration with its godoc.file:line:col:(click-jumpable in terminals/IDEs); the rest of the line keeps the same shapetext/templateproduces at runtime.field or methodfor clarity.checkCallArgumentswas returning the parameter type instead of the function's result on the pointer-deref fallback;builtInCheckhad copy-pastedbuilt-in eq…messages, an off-by-one inslicearg-count, and panicked on emptyargTypesforlen/slice/index.The
cmd/check-templatesCLI now prints viacheck.FormatVerbose(err), which walkserrors.Jointrees and prefers each leaf's verbose form.Test plan
go test ./...go vet ./...staticcheck ./...gofmt -l .EqualError/ErrorContainsand scripttest patterns to match the new format.error_verbose_test.goanderror_verbose_internal_test.gocovering the new error types,Unwrap, fallback behavior, joined-error walking, and the source-rendering helper (with and without godoc).