golden

package
v2.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package golden holds JSON-fixture helpers for tests that maintain testdata/ goldens. The package owns the shared -update flag so multiple consumers route through one switch.

Index

Constants

This section is empty.

Variables

View Source
var Update = flag.Bool("update", false, "rewrite testdata/*.json golden fixtures from current test output")

Update is the shared -update flag for golden regeneration.

Functions

func LoadJSON

func LoadJSON(t testing.TB, name string, out any)

LoadJSON reads testdata/<name>.json relative to the calling test's package directory and decodes it into out.

func WriteJSON

func WriteJSON(t testing.TB, name string, v any)

WriteJSON marshals v with MarshalIndent and writes it to testdata/<name>.json, creating the directory if necessary.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL