Help us shape the future of Go! Take the 2026 Go Developer Survey

proof

package
v0.127.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package proof hosts a proof image in a public GitHub repository so a public issue or pull request thread can show it: one commit on the repository's images-only branch through the Git data API, made with the gh CLI's own login, and a Markdown image line pinned to that commit.

Index

Constants

View Source
const Branch = "beekeeper-proofs"

Branch holds the proof images of a repository: an orphan branch with nothing but images, so it runs no workflow and never meets the default branch.

View Source
const MaxBytes = 10 << 20

MaxBytes bounds the image read: a screenshot is far smaller.

Variables

View Source
var ErrConflict = errors.New("the proofs branch moved")

ErrConflict is a ref update GitHub refused because the branch moved.

Functions

func Normalize

func Normalize(raw []byte) ([]byte, error)

Normalize decodes a PNG, JPEG or GIF image and encodes it as PNG, which keeps the pixels and drops every metadata chunk (EXIF, text, comments).

func Path

func Path(img []byte, now time.Time) string

Path is where an image goes on the branch: the UTC date and time and the image's digest; it names no thread, repository or person.

func RunGH

func RunGH(ctx context.Context, input []byte, args ...string) ([]byte, error)

RunGH is GH through the gh binary the caller's PATH resolves: an agent's gh carries the App's token, which beekeeper never reads.

Types

type GH

type GH func(ctx context.Context, input []byte, args ...string) ([]byte, error)

GH runs the gh CLI with input on its stdin and returns its stdout; err carries its stderr.

type Result

type Result struct {
	Commit   string `json:"commit"`
	Path     string `json:"path"`
	URL      string `json:"url"`
	Markdown string `json:"markdown"`
}

Result is a hosted image: where it lives and the Markdown that shows it.

type Upload

type Upload struct {
	GH   GH
	Repo string
	Alt  string
	Now  time.Time
}

Upload is one image hosted in Repo.

func (Upload) Run

func (u Upload) Run(ctx context.Context, img []byte) (Result, error)

Run hosts img (already normalized) on the branch and returns its link. A repository that is not public is refused: its image would not render for a public thread's readers.

Jump to

Keyboard shortcuts

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