Skip to content

Release Notes v0.9.0

Released: 2026-10-22

Highlights

Fixtures and golden files that compare equal on Windows. Git can check text files out with CRLF there, so a golden file read from disk differs from the same content generated in the test. testutil.ReadFileLF and testutil.AssertGolden hide the difference, and fs.NormalizeLineEndingsBytes joins the string form.

New Features

testutil.ReadFileLF

Reads a text file and converts CRLF to LF. It fails the test if the file cannot be read.

testutil.AssertGolden

Compares generated bytes with a golden file, ignoring CRLF versus LF in the file. With update set, it writes the file instead and creates the directory.

var update = flag.Bool("update", false, "rewrite the golden files")

testutil.AssertGolden(t, "testdata/out.json", got, *update)

fs.NormalizeLineEndingsBytes

fs.NormalizeLineEndings for bytes. It returns a new slice and leaves its argument unchanged.

Documentation

  • The testutil guide covers fixtures and golden files.
  • The portable tests guide recommends the helpers, and .gitattributes for byte-exact comparisons.

Installation

go get github.com/grokify/oscompat@v0.9.0

Compatibility

Nothing changes for existing code. The module still has no dependencies outside the standard library.