go-puppet documentation¶
A pure-Go (no cgo) implementation of the Puppet language. go-puppet/puppet
parses Puppet 8 manifests into a faithful Puppet::Pops-style AST and compiles
them to a catalog — a resource graph with containment and relationship edges,
serializable to Puppet catalog JSON. The module path is
github.com/go-puppet/puppet.
The type system is delegated to go-pcore, data binding to go-hiera, and facts to go-facter — never reimplemented.
Status: v0.1 complete
Lexer, parser, AST, evaluator and catalog compiler — at 100% coverage,
gofmt + go vet clean, CI green across the six 64-bit Go targets (amd64,
arm64, riscv64, loong64, ppc64le, s390x). EPP/ERB templates, resource
defaults/overrides/collectors, exported resources and the full stdlib are
staged for v0.2.
Install¶
Quick taste¶
package main
import (
"fmt"
"github.com/go-puppet/puppet/eval"
)
func main() {
cat, logs, err := eval.EvalString(`
class nginx (Integer[1,65535] $port = 80) {
package { 'nginx': ensure => installed }
-> service { 'nginx': ensure => running, require => Package['nginx'] }
}
include nginx
`)
if err != nil {
panic(err)
}
for _, l := range logs {
fmt.Printf("[%s] %s\n", l.Level, l.Message)
}
fmt.Println(cat.JSON()) // Puppet catalog JSON
}
Where to next¶
- The language — the grammar the lexer and parser cover.
- Evaluation & catalog — scopes, functions, iteration, the catalog model.
- Usage & API — the Go surface.
- Roadmap — what is staged for v0.2.