diene.go-config

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT

README

Diene Go config library

CI Unit coverage Integration coverage Meta coverage Go Reference Commit activity

Diene's reproducible development environment is managed by Nix. Run direnv allow once, then use pls tasks from the loaded shell.

This repository inherits the all-features workspace baseline: split CI/CD, secrets, release configuration, validators, standards, and vendored agent-skill synchronization.

Commands

  • pls setup — synchronize installed diene package skills.
  • pls lint — run every pre-commit gate.
  • pls secret:scan — scan tracked content for secrets.
  • pls skills:sync — rebuild .claude/skills/vendor/ from installed packages.

Publishable Go module

github.com/AtomiCloud/diene.go-config is the Go family's configuration merger and validator. It layers full base YAML, sparse landscape overrides, and indexed environment overrides, validates the final tree against a service-composed generated schema, and serves typed configuration slices.

go get github.com/AtomiCloud/diene.go-config@latest
loader := config.NewLoader(
	config.WithEnvPrefix("MYAPP"),
	config.WithBaseDir("config/app"),
	config.WithSchema(config.ComposeSchema(config.AppBlockSchema())),
)
cfg, err := loader.Load(context.Background())

Go commands

  • pls build — build every package in the module.
  • pls typecheck — compile every source package without running tests.
  • pls test / pls test:coverage — run unit, integration, and active meta tiers.
  • pls deadcode — run strict whole-repository and production passes plus the LLM-lax report.
  • pls up / pls down — start or stop local dependencies.
  • ./scripts/ci/pkg-validate.sh all — run module-path, vet, API, docs, and example validators.

See the Go baseline for the language contract and template-maintenance boundary. See the Go library baseline for promotion, testing, compatibility, and publication policy.

Standards

Shared standards

Domain-specific documentation belongs under docs/domain/. The docs/standards/contracts/ location is reserved for the separately owned C0 contracts standard.

Go language variants

Directories

Path Synopsis
internal
examplecov
Package examplecov analyzes a Go package's exported API surface and reports which units lack an associated Example function, so full example coverage is mechanically enforced rather than trusting whatever examples happen to exist.
Package examplecov analyzes a Go package's exported API surface and reports which units lack an associated Example function, so full example coverage is mechanically enforced rather than trusting whatever examples happen to exist.
lib
config
Package config loads, merges, validates, and decodes Diene service configuration.
Package config loads, merges, validates, and decodes Diene service configuration.
config/internal/clone
Package clone deep-clones the string-keyed configuration domain so a caller cannot mutate a value it handed across a public ownership boundary.
Package clone deep-clones the string-keyed configuration domain so a caller cannot mutate a value it handed across a public ownership boundary.
config/internal/collision
Package collision detects sibling configuration keys whose canonical (separator- and case-insensitive) forms collide, within a single tree and recursively through nested objects and arrays of objects.
Package collision detects sibling configuration keys whose canonical (separator- and case-insensitive) forms collide, within a single tree and recursively through nested objects and arrays of objects.
config/internal/layers
Package layers builds and resolves the YAML configuration layers: it parses documents with two Viper instances, folds the overlay onto the base with MergeConfigMap after aligning cross-spelled keys canonically, resolves and validates the landscape token, and safely resolves a file-mode overlay path.
Package layers builds and resolves the YAML configuration layers: it parses documents with two Viper instances, folds the overlay onto the base with MergeConfigMap after aligning cross-spelled keys canonically, resolves and validates the landscape token, and safely resolves a file-mode overlay path.
config/internal/nilguard
Package nilguard reports whether an interface value is nil or a typed nil (an interface wrapping a nil pointer, map, slice, func, or channel), so a public API can reject a missing dependency with a deterministic error instead of panicking on it.
Package nilguard reports whether an interface value is nil or a typed nil (an interface wrapping a nil pointer, map, slice, func, or channel), so a public API can reject a missing dependency with a deterministic error instead of panicking on it.
config/internal/resource
Package resource derives the schema resource identifier a composed configuration block is mounted under.
Package resource derives the schema resource identifier a composed configuration block is mounted under.
config/internal/schemaview
Package schemaview turns an authored draft-2020-12 configuration schema into the form the validator actually evaluates, so that one equivalence relation governs both sides of validation.
Package schemaview turns an authored draft-2020-12 configuration schema into the form the validator actually evaluates, so that one equivalence relation governs both sides of validation.
config/internal/tree
Package tree resolves dotted configuration keys against a merged map using the family's canonical, casing-insensitive key matching.
Package tree resolves dotted configuration keys against a merged map using the family's canonical, casing-insensitive key matching.
config/internal/valid
Package valid compiles a composed JSON Schema, normalizes a configuration instance, validates it, and renders failures as problem-typed errors.
Package valid compiles a composed JSON Schema, normalizes a configuration instance, validates it, and renders failures as problem-typed errors.
scripts
validate command
Command examples_coverage fails when any exported symbol of a target package lacks an associated Example function, so full-public-surface example coverage is mechanically enforced rather than trusting that whatever examples exist compile.
Command examples_coverage fails when any exported symbol of a target package lacks an associated Example function, so full-public-surface example coverage is mechanically enforced rather than trusting that whatever examples exist compile.
Package testhelper ships the fake configuration sources, schema and overlay fixtures, pre-validated stub builders, and fail-fast assertions that consumers of github.com/AtomiCloud/diene.go-config would otherwise repeat in every test.
Package testhelper ships the fake configuration sources, schema and overlay fixtures, pre-validated stub builders, and fail-fast assertions that consumers of github.com/AtomiCloud/diene.go-config would otherwise repeat in every test.

Jump to

Keyboard shortcuts

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