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

model

package
v1.4.15 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package model holds the public facts document (contract:cli.public-facts v1) and its exported constants.

Purpose: one Go type for .github/facts.json, shared by tools/facts (which writes and checks it) and tools/schemagen (which derives the JSON Schema), so the document and its schema cannot drift. Inputs: none. Outputs: the Facts type and constants. Constraints: struct fields are declared in the document's key order (sorted, `_generated` first), because encoding/json writes struct fields in declaration order and the contract requires sorted keys. No timestamps and no machine-dependent values.

Index

Constants

View Source
const (
	// SchemaVersion is the schema_version value of a v1 document.
	SchemaVersion = "1"
	// Generated is the _generated marker (hand-edit warning).
	Generated = "GENERATED BY tools/facts — DO NOT HAND EDIT"
	// ContractMode is the compat mode the committed command registry documents.
	ContractMode = "v1.5"
	// VersionPattern is the shape of Facts.Version (the .github/VERSION value).
	VersionPattern = `^[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$`
	// SHA256Pattern is the shape of the source hashes.
	SHA256Pattern = `^[0-9a-f]{64}$`
)

Contract constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counts

type Counts struct {
	Commands    int      `json:"commands"`
	Core        int      `json:"core"`
	CoreMissing []string `json:"core_missing"`
	TopLevel    int      `json:"top_level"`
}

Counts are copied from the registry's counts block.

type Facts

type Facts struct {
	Generated    string   `json:"_generated"`
	ContractMode string   `json:"contract_mode"`
	Counts       Counts   `json:"counts"`
	SchemaVer    string   `json:"schema_version"`
	Sources      Sources  `json:"sources"`
	Verbs        []string `json:"verbs"`
	Version      string   `json:"version"`
}

Facts is .github/facts.json.

type Sources

type Sources struct {
	OpenAPISHA256  *string `json:"openapi_sha256"`
	RegistrySHA256 string  `json:"registry_sha256"`
}

Sources records which committed files the facts were projected from. OpenAPISHA256 is null when .github/openapi.json is absent.

Jump to

Keyboard shortcuts

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