jsonout

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package jsonout writes the CLI's stable {ok,data,error} JSON envelope to stdout. Library callers should NOT depend on this — it exists only to keep the CLI's interface uniform across every subcommand.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Failure

func Failure(kind, msg string, details any) error

Failure writes {"ok":false,"error":{...}} to stdout.

func Success

func Success(data any) error

Success writes {"ok":true,"data":...} to stdout.

Types

type Envelope

type Envelope struct {
	OK    bool      `json:"ok"`
	Data  any       `json:"data,omitempty"`
	Error *ErrorBox `json:"error,omitempty"`
}

Envelope is the on-the-wire shape. Exactly one of Data / Error is set.

type ErrorBox

type ErrorBox struct {
	Kind    string `json:"kind"`
	Message string `json:"message"`
	Details any    `json:"details,omitempty"`
}

ErrorBox is the structured error returned by the CLI.

Jump to

Keyboard shortcuts

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