You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
github.com/BurntSushi/toml is Go's most widely-used TOML parser. It implements the full TOML 1.0 spec and TOML 1.1 features (since v1.3.0), providing a streaming NewDecoder API, MetaData for unknown-key introspection, and structured ParseError values with precise line/column positioning. It is the backbone of the gh-aw-mcpg TOML configuration loader.
toml.NewDecoder(file) — streaming decoder (memory-efficient for large configs)
decoder.Decode(&cfg) — populates the Config struct with TOML values
toml.ParseError — structured error value with .Position.Line / .Position.Col
toml.Key ([]string) — key path type used in MetaData.Undecoded() inspection
MetaData.Undecoded() — detects TOML keys not mapped to any struct field
toml.Key.String() — human-readable key path in error messages
Usage Pattern — Unknown Field Detection
The project uses a sophisticated pattern that cannot rely on Decoder.SetStrict(true) because the config contains map[string]interface{} sections (guard_policies, guards.*.config) that accept arbitrary nested keys by design. Instead, it:
Calls md.Undecoded() to collect all unrecognized keys
Filters them through isDynamicTOMLPath() to exempt the flexible map sections
Returns a descriptive error for any remaining unknown keys
This is exactly the right approach and is well-documented in the code comments.
✅ Comprehensive comments explaining design decisions and spec references
✅ Running on latest version (v1.6.0)
✨ Feature Opportunities
SetStrict revisit: If the guard_policies and guards.*.config sections are ever refactored from map[string]interface{} to typed structs, Decoder.SetStrict(true) could replace the custom isDynamicTOMLPath logic entirely, reducing ~20 lines of code and improving maintainability.
Config serialization: toml.Marshal / toml.Encode could be used for a future "dump effective config" diagnostic command — useful for debugging complex config setups with variable expansion. Not currently needed but worth keeping in mind.
toml.Unmarshal for unit tests: Test helpers that construct TOML from strings could use toml.Unmarshal([]byte(...), &cfg) instead of writing temp files, slightly simplifying some test setup patterns.
📐 Best Practice Alignment
The project is already fully aligned with BurntSushi/toml best practices. The code comments in config_core.go are exemplary — they document the TOML version features used, the rationale for SetStrict avoidance, and the spec sections being enforced. This is a model implementation for any Go project using TOML configuration.
🔧 General Improvements
No improvements identified. The module usage is idiomatic, efficient, and thoroughly documented.
Recommendations
No action required on current usage — the implementation is production-quality and already on the latest version.
Track SetStrict simplification opportunity — if/when map[string]interface{} sections are typed, replace isDynamicTOMLPath with SetStrict(true) for a cleaner implementation.
Consider toml.Unmarshal in tests — minor ergonomic win for constructing test fixtures from inline TOML strings.
Next Steps
No urgent follow-up needed.
Revisit SetStrict opportunity if the config schema undergoes structural refactoring.
Generated by Go Fan 🐹 Module: github.com/BurntSushi/toml v1.6.0 Reviewed: 2026-05-12 Next review candidate: github.com/santhosh-tekuri/jsonschema/v5
Note
🔒 Integrity filter blocked 10 items
The following items were blocked because they don't meet the GitHub integrity level.
BurntSushi/toml@b66ba2aget_commit: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".
santhosh-tekuri/jsonschema@d3bf053get_commit: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".
spf13/pflag@18450eaget_commit: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".
🐹 Go Fan Report: BurntSushi/toml
Module Overview
github.com/BurntSushi/tomlis Go's most widely-used TOML parser. It implements the full TOML 1.0 spec and TOML 1.1 features (since v1.3.0), providing a streamingNewDecoderAPI,MetaDatafor unknown-key introspection, and structuredParseErrorvalues with precise line/column positioning. It is the backbone of thegh-aw-mcpgTOML configuration loader.Current Usage in gh-aw-mcpg
internal/config/config_core.go,internal/config/config_core_test.go)toml.NewDecoder(file)— streaming decoder (memory-efficient for large configs)decoder.Decode(&cfg)— populates theConfigstruct with TOML valuestoml.ParseError— structured error value with.Position.Line/.Position.Coltoml.Key([]string) — key path type used inMetaData.Undecoded()inspectionMetaData.Undecoded()— detects TOML keys not mapped to any struct fieldtoml.Key.String()— human-readable key path in error messagesUsage Pattern — Unknown Field Detection
The project uses a sophisticated pattern that cannot rely on
Decoder.SetStrict(true)because the config containsmap[string]interface{}sections (guard_policies,guards.*.config) that accept arbitrary nested keys by design. Instead, it:md.Undecoded()to collect all unrecognized keysisDynamicTOMLPath()to exempt the flexible map sectionsThis is exactly the right approach and is well-documented in the code comments.
Research Findings
v1.6.0(latest)Recent Updates (v1.6.0)
Decoder.SetStrict(true)added as a first-class API for strict unknown-field rejectionBest Practices (from maintainers)
NewDecoderoverDecodeFile/DecodeReaderwhen you control theio.Readerlifecycle (allowsdefer file.Close()at call site)errors.As(err, &toml.ParseError{})to extract structured position infoMetaData.Undecoded()whenSetStrictis not viable (e.g., mixed typed-struct + map sections)%wto preserve the structured type for callersImprovement Opportunities
🏃 Quick Wins
None required. The current usage already follows every best practice:
NewDecoderParseErrorextracted witherrors.Asand logged with line/column%wto preserve structured type for callersUndecoded()+isDynamicTOMLPathcorrectly implements per-section strict/lax logic✨ Feature Opportunities
SetStrictrevisit: If theguard_policiesandguards.*.configsections are ever refactored frommap[string]interface{}to typed structs,Decoder.SetStrict(true)could replace the customisDynamicTOMLPathlogic entirely, reducing ~20 lines of code and improving maintainability.toml.Marshal/toml.Encodecould be used for a future "dump effective config" diagnostic command — useful for debugging complex config setups with variable expansion. Not currently needed but worth keeping in mind.toml.Unmarshalfor unit tests: Test helpers that construct TOML from strings could usetoml.Unmarshal([]byte(...), &cfg)instead of writing temp files, slightly simplifying some test setup patterns.📐 Best Practice Alignment
The project is already fully aligned with BurntSushi/toml best practices. The code comments in
config_core.goare exemplary — they document the TOML version features used, the rationale forSetStrictavoidance, and the spec sections being enforced. This is a model implementation for any Go project using TOML configuration.🔧 General Improvements
No improvements identified. The module usage is idiomatic, efficient, and thoroughly documented.
Recommendations
SetStrictsimplification opportunity — if/whenmap[string]interface{}sections are typed, replaceisDynamicTOMLPathwithSetStrict(true)for a cleaner implementation.toml.Unmarshalin tests — minor ergonomic win for constructing test fixtures from inline TOML strings.Next Steps
SetStrictopportunity if the config schema undergoes structural refactoring.Generated by Go Fan 🐹
Module:
github.com/BurntSushi/tomlv1.6.0Reviewed: 2026-05-12
Next review candidate:
github.com/santhosh-tekuri/jsonschema/v5Note
🔒 Integrity filter blocked 10 items
The following items were blocked because they don't meet the GitHub integrity level.
get_commit: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".get_commit: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".get_commit: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".get_commit: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".get_commit: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".get_latest_release: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".get_latest_release: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".get_latest_release: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".get_latest_release: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".get_file_contents: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".To allow these resources, lower
min-integrityin your GitHub frontmatter: