report

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package report renders a probe.Result as a human-readable summary, as JSON, or as a shields.io endpoint badge.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteBadge

func WriteBadge(w io.Writer, r probe.Result) error

WriteBadge writes the shields.io endpoint JSON.

func WriteJSON

func WriteJSON(w io.Writer, r probe.Result) error

WriteJSON writes the full Result as pretty-printed JSON.

func WritePretty

func WritePretty(w io.Writer, r probe.Result, color bool)

WritePretty prints a check table and an overall verdict line.

Types

type Badge

type Badge struct {
	SchemaVersion int    `json:"schemaVersion"`
	Label         string `json:"label"`
	Message       string `json:"message"`
	Color         string `json:"color"`
	CacheSeconds  int    `json:"cacheSeconds"`

	Server    string `json:"_server,omitempty"`
	CheckedAt string `json:"_checkedAt,omitempty"`
	Verdict   string `json:"_verdict,omitempty"`
}

Badge is the shields.io endpoint schema (schemaVersion 1). Extra underscore fields are ignored by shields.io and carried for our own embeds.

Embed: img.shields.io/endpoint?url=<hosted badge json url>

func NewBadge

func NewBadge(r probe.Result) Badge

NewBadge builds a shields.io endpoint badge from a probe result. A healthy server reads "verified <date>"; anything else reads its verdict, so a stale or broken server can never masquerade as verified.

Jump to

Keyboard shortcuts

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