DEV Community

AdriaanLouw
AdriaanLouw

Posted on

GoBug: a Go error explainer that actually speaks plain English

The problem nobody fixed

Go's tooling is genuinely excellent at finding problems. go build catches compile errors, go vet catches suspicious patterns, golangci-lint bundles a hundred more checks on top of that. If something's wrong with your code, Go's ecosystem will tell you.

What it won't do is explain it to you.

./main.go:6:6: undefined: fmt.Printlmn
Enter fullscreen mode Exit fullscreen mode

If you've been writing Go for five years, you read that in half a second:
typo, should be Println.

If you started three weeks ago, that's a wall of unfamiliar syntax pointing at a problem you can't parse yet — and that's the exact moment a lot of beginners quietly close the tab.

So I built the missing layer: GoBug, a native run-area for Go that turns
raw compiler and runtime errors into plain-English explanations, with a
suggested fix, right next to your code.

What it actually is

Not a new linter. Not a rival to go vet or golangci-lint — those already do the hard work of detection better than anything I could build in a weekend, and reinventing them would be a waste of a good ecosystem.

GoBug is a thin, focused translation layer on top of tools Go developers already trust.

The interaction is deliberately boring: paste or write Go code on the left, hit Run, see output on the right. If it fails, you get the raw error and a plain-English explanation underneath it.

How it works under the hood

GoBug is a small native desktop app built with Wails (Go a thin webview shell — no Electron, no bundled Chromium).

When you hit Run, it:

  • Writes your code to a temp file
  • Runs it with your local go run — your own toolchain, nothing sandboxed or sent anywhere
  • Captures stdout/stderr
  • On failure, runs the raw output through a rule-based explain engine

The explain engine (v0.1) covers the errors that trip up beginners constantly: undefined identifiers, type mismatches, unused imports/variables,
missing returns, nil pointer panics, index-out-of-range panics. Each one is a regex match plus a hand-written explanation — no AI required to be useful out of the box.

{
    Name:    "undefined identifier",
    Pattern: regexp.MustCompile(`undefined: (\w+)`),
    Explain: func(m []string) string {
        return "Go can't find something named \"" + m[1] + "\". This usually means:\n" +
            "  - you misspelled it\n" +
            "  - you forgot to declare it before using it\n" +
            "  - you meant to import a package that provides it, but didn't"
    },
},
Enter fullscreen mode Exit fullscreen mode

Because it's local-first and shells out to your own toolchain, there's no
untrusted-code-execution problem to solve — the same trust boundary as
typing go run yourself.

What's next

The rule set is intentionally small right now — 7 rules is a start, not a
finish line.

The next milestone is a BYOK (bring your own key) fallback:
anything the rule set doesn't recognize gets explained by an AI model using your own API key, so nothing is gated behind a service I run or a cost you didn't sign up for.

After that: piping golangci-lint output through the same explain layer, and proper syntax highlighting in the editor.

Try it

It's MIT licensed and fully open source: https://github.com/hotgrin/gobug

If you're learning Go, I'd genuinely love to know which error messages
still confuse you — that's exactly the list the next batch of rules should
come from.

Issues and PRs welcome, and if it's useful, a star helps other
people find it, thanks.

Top comments (1)

Collapse
 
adriaanlouw profile image
AdriaanLouw

Hi, thank you for reading! Any ideas or suggestions? Reserving this space for future communication, thanks.