Title: Show HN: AssertGo – Fluent Assertion Library for Go
The developer introduces AssertGo, a fluent assertion library for Go inspired by AssertJ, leveraging Go 1.27's generic methods to replace any-based top-level methods. The library provides chainable assertions for strings, integers, slices, maps, and types, with all design choices made by the author and code generated with Claude Sonnet in incremental commits.
Background
- AssertJ is a popular Java library that provides "fluent assertions" — a style where you chain method calls (e.g., `assertThat(x).isNotNull().hasSize(3)`) to make test code read like plain English. Many Java developers find it far more readable than Go's built-in `if x != y { t.Fatal(...) }` pattern.
- Go (Golang) is a statically typed language originally designed by Google. Its type system has historically lacked generics (type parameters like `T` in `List<T>`), which were only added in Go 1.18 (2022). However, until Go 1.27 (expected late 2025), generic methods — methods that define their own type parameters — were forbidden, meaning libraries couldn't write a single `.EqualTo(val T)` method that works for any type. Go 1.27 lifts that restriction.
- The author is showing off a new open-source library that leverages this freshly available feature to bring AssertJ-style fluent assertions to Go, which previously required per-type helpers (e.g., `AssertInt`, `AssertString`) or sacrificing type safety with `any` (Go's `Object` equivalent).
- "Show HN" is a category on Hacker News where developers share projects they built.