From c820d83ae27934f0dd8c17ddb22ff4a785ef39e7 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Wed, 1 Oct 2025 11:24:19 +0200 Subject: [PATCH] interp: better errors when debugging interp When debugging is enabled for interp, print better errors in a specific case. Before: !! revert because of error: interp: unsupported instruction (to be emitted at runtime) After: !! revert because of error: /usr/local/go1.24.0/src/regexp/syntax/parse.go:927:27: interp: unsupported instruction (to be emitted at runtime) So this adds error location information, which can be quite useful. --- interp/interpreter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interp/interpreter.go b/interp/interpreter.go index f6fb7bf3b..629c17d56 100644 --- a/interp/interpreter.go +++ b/interp/interpreter.go @@ -577,7 +577,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent // runtime instead of at compile time. But we need to // revert any changes made by the call first. if r.debug { - fmt.Fprintln(os.Stderr, indent+"!! revert because of error:", callErr.Err) + fmt.Fprintln(os.Stderr, indent+"!! revert because of error:", callErr.Error()) } callMem.revert() err := r.runAtRuntime(fn, inst, locals, &mem, indent)