Skip to content

Release Notes v0.3.0

Released: 2026-04-27

Highlights

Breaking change: Capture functions now return errors for proper error handling.

Breaking Changes

The testutil capture functions now return errors to enable proper error handling when stdout/stderr redirection fails.

Migration Guide

Before (v0.2.0):

stdout := testutil.CaptureStdout(func() {
    myCommand.Execute()
})

After (v0.3.0):

stdout, err := testutil.CaptureStdout(func() {
    myCommand.Execute()
})
if err != nil {
    t.Fatalf("failed to capture stdout: %v", err)
}

Changed Functions

Function Old Signature New Signature
CaptureStdout func(fn func()) string func(fn func()) (string, error)
CaptureStderr func(fn func()) string func(fn func()) (string, error)
CaptureOutput func(fn func()) (string, string) func(fn func()) (string, string, error)

New Features

fs.NormalizeLineEndings

New function for converting CRLF line endings to LF, useful when comparing file contents across platforms.

import "github.com/grokify/oscompat/fs"

normalized := fs.NormalizeLineEndings(content)

Use cases:

  • Comparing file contents in tests regardless of platform
  • Processing text files that may have been edited on Windows
  • Normalizing output before assertions

Installation

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