Early-stage software. Shurli is experimental and built with AI assistance. It will have bugs. Not recommended for production or safety-critical use. Read the disclaimer.
Clean Code, Clear Errors

Clean Code, Clear Errors

February 12, 2026·
Satinder Grewal

Clean Code, Clear Errors

What’s new

Every error in Shurli is now a named, checkable sentinel value. Structured logging via log/slog replaces ad-hoc log.Printf calls everywhere. And every binary now self-identifies with its exact build version.

Why it matters

When you’re debugging a P2P connection issue at 2am, you need to know exactly which version is running on each peer and what went wrong. “Service not found” as a string is useless for programmatic error handling. errors.Is(err, ErrServiceNotFound) is actionable.

Technical highlights

From printf to structured logging - before and after comparison

  • Sentinel errors: ErrServiceNotFound, ErrNameNotFound, ErrConfigNotFound, ErrNoArchive, and more. All checkable with errors.Is()
  • Structured logging: slog.Info("connection succeeded", "attempt", 3, "peer", peerID[:16]+"...") - key-value pairs, not format strings
  • Build version embedding: -ldflags "-X main.version=... -X main.commit=..." at build time. shurli version shows exact build info
  • UserAgent in Identify: Every peer announces its version (shurli/0.1.0). shurli daemon peers shows what version each peer runs
  • Relay address deduplication: Same relay with IPv4 and IPv6 addresses? Merged into one entry automatically

What’s next

Self-healing capabilities: config archive/rollback and the commit-confirmed pattern.