Urgent.News

What's breaking now, across thousands of outlets.

Tech

Catch Bad Validation Tags at Compile Time with checkerlint

Struct tags are just strings — a typo'd checker name, a wrong-typed field, or a renamed cross-field target all compile fine and fail silently at runtime. checkerlint catches all three before you ship. Struct tags are string literals. The Go compiler checks that your struct compiles — it has no idea what checkers:"eq-field:Passwrd" means, so a typo in a field name, a checker applied to a field of…

Struct tags in Go are simply strings, which can lead to bugs if typos or misconfigurations occur. The checkerlint tool, a go/analysis-based static analyzer, reads these tags during build/lint time to catch issues like unknown checker names, type incompatibility, and cross-field target errors before shipping. Checkerlint checks for three main issues: unknown checker names, type compatibility, and cross-field targets.

It verifies that checker names are registered, that the field type matches the checker requirements, and that cross-field targets reference existing fields. This tool helps prevent silent runtime errors caused by invalid struct tags, catching them during the development process and ensuring a more stable and reliable application.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

99.7% Rejected in 84ms: Why I Stopped Making the Generator Smarter

I wrote a puzzle generator whose acceptance rate is 0.26% . It throws away 99.7% of everything it produces, and that is the design working as intended, not failing.

  • 99.7% rejection rate means only 0.26% of puzzles accepted
  • Generator produces plausible letter combinations, verifier checks solutions
  • Verifier's exhaustive search and unique solution guarantee maintain rejection rates

Returning RFC 9457 Problem Details from Go Validation Errors

How to turn struct-tag validation failures into a standard "application/problem+json" response — the RFC 9457 format — with one method call, no hand-rolled error envelope.

  • Checker provides RFC 9457 format response for Go validation errors
  • CheckErrors.ProblemDetails() generates application/problem+json body
  • CheckStruct() method converts validation errors to properly formatted response

Exit code 0 is a lie: 7 ways my unattended automation silently did nothing

I run about thirty scheduled jobs on a single Windows box. Some are scrapers, some generate content, some are trading bots, some just check that the other jobs are alive.

  • Exit code 0 does not reliably indicate success
  • Unattended automation reported success for every failure
  • Seven specific ways automation silently failed

More from Sunday 6 September →