hostgen

package
v0.2026340.700 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2026 License: MIT Imports: 6 Imported by: 1 module, 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 hostgen generates the source of the shared charly-lib host binary from a DATA pins list (`<name>@<tag>` lines, the format of charly's scripts/host-command-plugins.txt): a go.mod requiring the sdk and each pinned plugin, and a main.go registering each plugin with charlylib.Run. It names no plugin; adding one changes only the pins. Used by the cmd/charly-lib-gen command (the release build) and by deploykit's check-bed build of the in-development package.

Index

Constants

View Source
const DefaultGoVersion = "1.26.4"

DefaultGoVersion is the go directive stamped into the generated go.mod.

Variables

This section is empty.

Functions

func CheckGenerated

func CheckGenerated(outDir string, files map[string][]byte) error

CheckGenerated verifies outDir's files already equal the generated bytes.

func GoModuleVersion

func GoModuleVersion(tag string) (string, error)

GoModuleVersion maps a superproject-style git tag `vYYYY.DDD.HHMM` to the Go module version scheme the plugin repos use, `v0.<YYYYDDD>.<HHMM with leading zeros stripped>` (matching the sdk/spec convention; e.g. v2026.239.1615 → v0.2026239.1615).

func RenderGoMod

func RenderGoMod(module, sdkVersion, goVersion string, pins []Pin) []byte

RenderGoMod emits the host module's go.mod. Requires are sorted (deterministic) with sdk first, then plugins.

func RenderMain

func RenderMain(pinsPath string, pins []Pin) []byte

RenderMain emits the argv[0]-dispatch registry literal. The header names the pins file's BASE name (not its path) so output is machine-independent and the reproducibility gate is stable.

Types

type Pin

type Pin struct {
	Name    string // e.g. "plugin-clean" (the binary base name)
	Module  string // e.g. "github.com/opencharly/plugin-clean/candy/plugin-clean"
	Tag     string // e.g. "v2026.239.1615" (the superproject-style git tag)
	Version string // e.g. "v0.2026239.1615" (the plugin's Go module version)
}

Pin is one parsed `<name>@<tag>` entry with its derived module path + Go module version.

func Generate

func Generate(pinsPath, module, sdkVersion, goVersion string) (map[string][]byte, []Pin, error)

Generate renders the shared host module for a pins list: its go.mod (requiring the sdk at sdkVersion and each pinned plugin at its Go module version) and its main.go registry. The same pins and versions give byte-identical files.

func ParsePins

func ParsePins(path string) ([]Pin, error)

ParsePins reads `<name>@<tag>` lines, ignoring blanks and `#` comments, and derives each plugin's module path + Go module version. Duplicate names are an error (a registry key would silently collide).

Jump to

Keyboard shortcuts

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