encoding

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package encoding aggregates the nine text-codec host modules that live under std/encoding/*: base64, csv, hex, ini, json, toml, url, xml, yaml.

Each of the nine uses none of std's shared sandbox/exec helpers (resolvePath, checkRead, checkWrite, optStringDefault, ...) - every helper a text codec needs is local to its own file - so splitting them into their own leaf packages hides real behavior behind a real package boundary instead of just renaming a file. See magus-local-development's survey for the modules that do NOT have this property (fs, http, crypto, env, path, os, vcs, archive): their shared helpers ARE the sandbox enforcement layer, so pulling any one of them out would force exporting resolvePath/checkRead/ checkWrite onto the public API - the wrong direction to move right after fixing bypasses of exactly those checks.

This package's Module values reach std's own registry vocabulary (the std.Module type) by importing std, which is the only direction that works: std/encoding needs the descriptor types, but std cannot import std/encoding back to collect these nine, or the two packages would cycle. So unlike the 24 modules still living flat in std, these nine do not self-register via an init() side effect into std's package-level map. Each leaf's register.go exposes a plain Modules() function (see e.g. std/encoding/json/register.go), this file aggregates all nine explicitly, and the union with std's own All()/Get() is computed one layer further up, in internal/hostmodules - the first package in the import graph that imports both std and std/encoding. That is also why this package exports only Modules()/Get(): nothing here needs std.Register or the internal registry map at all.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(name string) (std.Module, bool)

Get looks up one std/encoding module by name.

func Modules

func Modules() []std.Module

Modules returns every module std/encoding contributes to magus's host surface. Each is validated exactly as std.Register validates a module registering the ordinary way (see std.ValidateModule's doc for why this package cannot call Register itself), and a duplicate Name across leaves panics for the same reason std.Register's does: two modules answering to the same bare import name is a program error, not a runtime one, and this runs at package init time - before anything can call it with bad data in hand.

Types

This section is empty.

Directories

Path Synopsis
Package base64 is the "encoding/base64" host module: base64 lives under std/encoding rather than in std's own flat root because it, like its eight siblings, uses none of std's shared sandbox/exec helpers (resolvePath, checkRead, checkWrite, optStringDefault, ...) - every helper a text codec needs is local to its own file, so splitting it into its own package hides nothing that std itself needs to reach back into.
Package base64 is the "encoding/base64" host module: base64 lives under std/encoding rather than in std's own flat root because it, like its eight siblings, uses none of std's shared sandbox/exec helpers (resolvePath, checkRead, checkWrite, optStringDefault, ...) - every helper a text codec needs is local to its own file, so splitting it into its own package hides nothing that std itself needs to reach back into.
Package csv is the "encoding/csv" host module.
Package csv is the "encoding/csv" host module.
Package hex is the "encoding/hex" host module.
Package hex is the "encoding/hex" host module.
Package ini is the "encoding/ini" host module.
Package ini is the "encoding/ini" host module.
Package json is the "json" host module.
Package json is the "json" host module.
Package toml is the "toml" host module.
Package toml is the "toml" host module.
Package url is the "encoding/url" host module.
Package url is the "encoding/url" host module.
Package xml is the "xml" host module.
Package xml is the "xml" host module.
Package yaml is the "yaml" host module.
Package yaml is the "yaml" host module.

Jump to

Keyboard shortcuts

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