Use this page to quickly find the right example format.
- basic - End-to-end app config loading with file + env layering, validation, provenance, and redaction.
- transformer - Typed transform-stage canonicalization before tag validation, shown with
WithTransformerFunc(...).
Run it from the repository root:
go run ./examples/basic
go run ./examples/transformerRigging also includes executable examples in example_test.go.
These are surfaced on pkg.go.dev and can be run locally with:
go test -run '^Example' ./...Useful starting points:
Example- Basic multi-source load.ExampleLoader_Load- Typed load with validation.ExampleLoader_WithValidator- Custom validation.ExampleDumpEffective- Redacted effective config output.ExampleDumpEffective_withSources- Output with source attribution.ExampleDumpEffective_asJSON- JSON output mode.ExampleGetProvenance- Field-level provenance inspection.ExampleLoader_Strict- Strict mode behavior.ExampleValidationError- Handling aggregated validation errors.ExampleSource- Implementing a custom source.ExampleLoader_Watch- Watch API behavior.ExampleCreateSnapshot- Snapshot creation.ExampleWriteSnapshot- Snapshot persistence.Example_snapshotRoundTrip- End-to-end snapshot lifecycle.
- Need a quick end-to-end run: use basic.
- Need API behavior for one method: use GoDoc examples in
example_test.go. - Need guided learning: start at docs/quick-start.md, then return here for targeted examples.