migrationsink

package
v1.0.50 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package migrationsink is the leaf holding the §1.8 one-time-migration signal. It has no internal dependencies so both internal/keychain (the recorder) and internal/output (the JSON splicer) can import it without an import cycle — gro has no global JSON state, and the migration fires deep inside keychain.Open(), so the signal is recorded here run-scoped and delivered at output time (JSON splice) or flushed to stderr by root.runRoot. Consume-once, so it appears exactly once and never leaks into a later response or a parallel test.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlushMigrationNotice

func FlushMigrationNotice(w io.Writer)

FlushMigrationNotice emits the §1.8 human line to w iff a record is still pending (no JSON path consumed it), then consumes it. Wired once as a deferred call in root.runRoot so it fires on success AND error, above the os.Exit trap. Writing to stderr never corrupts a --json stdout body.

func Record

func Record(block interface{}, humanLine string)

Record stores the §1.8 block (anything that marshals to the `_migration` value, e.g. credstore.MigrationBlock) plus the human line for the stderr path. Never calling this means "no migration this run".

func Reset

func Reset()

Reset drops any pending record without emitting it. Test hook so one test's recorded migration can never bleed into another.

func Take

func Take() (block []byte, humanLine string)

Take returns the pending block + human line and clears both (consume-once). The block is nil when nothing is pending.

Types

This section is empty.

Jump to

Keyboard shortcuts

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