go-augeas

Augeas configuration-tree editing in pure Go โ€” parse, query and edit config files via lenses.

pure Go ยท zero cgo config tree XPath-like paths lenses 232 upstream lenses get / set / insert / move injectable FS seam 100% coverage 6 arches + wasm
Documentation GitHub
Documentation (MkDocs Material + mike) License: BSD-3-Clause Go 1.26.4+ Coverage 100%

go-augeas is a pure-Go (CGO_ENABLED=0) implementation of the core of Augeas, the configuration-editing tool from the Puppet ecosystem. It models configuration files as an ordered tree, exposes an XPath-like path language to query and edit that tree, and uses lenses to translate between the tree and concrete file syntax. A from-scratch pure-Go interpreter for the Augeas .aug lens DSL reads the entire embedded upstream lens corpus (232 modules) plus five original contrib lenses (Wireguard, Rclone, Caddyfile, Nftables, Unbound); write-back through those lenses is verified correct internally but not yet exposed via the public API. Load and save go through an injectable FileSystem seam, so parsing and error branches are covered deterministically without touching the disk. It imports only the Go standard library, holds 100% test coverage, and cross-compiles to the six 64-bit Go targets and WebAssembly.

Configuration tree ready

An ordered tree of labelled nodes with values, built by New(); every entry addressable by path, with Root, Label and node insertion/removal preserving order.

Path language ready

Absolute and relative paths, * name wildcard, // descendant axis, . / .., positional [n] / [last()], value [sub = 'v'], regexp [sub =~ 're'] (RE2), existence predicates, union |, and $var bindings.

Editing API ready

Get / Exists / Set / SetMultiple / Insert / Remove / Move / Match / Label / DefineVariable / DefineNode โ€” the full tree-mutation surface over path expressions.

Embedded `.aug` corpus interpreter ready

A from-scratch pure-Go interpreter reads the entire upstream Augeas 1.14.1 lens corpus (232 modules) plus 5 original contrib lenses (Wireguard, Rclone, Caddyfile, Nftables, Unbound), reachable via NewEngine().Lens(module, binding); Load / Save run through an injectable FileSystem seam. Verified 1791/1791 (100%) against the corpus’s own get+put test assertions.

Public put for interpreted lenses planned

The interpreter’s put (Build) is verified correct internally, but the public Engine.Lens(...) adapter only wires up Parse (get) today; TextRetrieve/Save don’t yet work on corpus/contrib lenses this way. Byte-offset Span tracking is a further follow-on.

The configuration-editing engine of the go-augeas org: an ordered tree, an XPath-like path language and a pure-Go interpreter for the whole embedded Augeas lens corpus, all dependency-free. Part of the pure-Go Puppet stack alongside go-facter, go-hiera, go-pcore and go-puppet.