Upgrade toml to v1.6.0 with metadata validation and enhanced error reporting #383
+328
−15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Plan: Implement BurntSushi/toml Module Improvements
Priority 1: Core Improvements ✅ COMPLETED
Priority 2: Enhanced Validation ✅ COMPLETED
Testing & Verification ✅ COMPLETED
Summary of Changes
Files Modified
github.com/BurntSushi/tomlfrom v1.5.0 to v1.6.0toml:struct tags to all Config, GatewayConfig, and ServerConfig fieldspErr.Position.Line(fixed deprecated API)Key Improvements
servrrsvsservers)toml:tags to prevent breaking changes from field refactoringOriginal prompt
This section details on the original issue you should resolve
<issue_title>[go-fan] Go Module Review: github.com/BurntSushi/toml</issue_title>
<issue_description># 🐹 Go Fan Report: BurntSushi/toml
Module Overview
The BurntSushi/toml package is Go's most popular TOML parser with 4,885+ stars, providing a reflection-based interface similar to
jsonandxmlfrom the standard library. It implements the TOML 1.1 specification for simple, idiomatic configuration file parsing.Current Usage in gh-aw-mcpg
The project uses this module for configuration file parsing, specifically in
internal/config/config.go:internal/config/config.go)toml.DecodeFile(path, &cfg)for TOML → struct mappingCurrent Implementation:
The module is used correctly but discards metadata that could enable validation and better error messages.
Research Findings
Recent Updates
Latest Version: v1.6.0 (December 18, 2025) - We're using v1.5.0⚠️
What's New in v1.6.0
Best Practices from Maintainers
Metareturn value for validationtoml:tags for all fieldsMeta.Undecoded()ParseErrorImprovement Opportunities
🏃 Quick Wins (High Impact, Low Effort)
1. Upgrade to v1.6.0 for TOML 1.1 Support
Current: v1.5.0
Action:
go get github.com/BurntSushi/toml@v1.6.0Benefits:
Impact: More flexible configuration files, better error messages
2. Capture and Use Metadata for Validation
Current: Metadata discarded with
_Recommended:
Benefits:
servrrsvsservers)Files:
internal/config/config.go:803. Improve Error Context with Line Numbers
Current: Generic "failed to decode TOML" error
Recommended:
Benefits: Users get exact line numbers for syntax errors
✨ Feature Opportunities (Medium Impact, Medium Effort)
4. Add Strict Mode for Typo Detection
Use
Meta.Undecoded()to detect unknown configuration keys:Benefit: Fail fast on configuration typos
5. Add TOML Export Capability
Currently the project only reads TOML. Add marshaling for:
📐 Best Practice Alignment
6. Add Explicit Struct Tags
Current: Relies on automatic case matching
Recommended: Explicit
toml:tags for all fieldsWhy: Prevents breaking changes from field name refactoring
Example:
Files to update:
internal/config/config.go(Config, GatewayConfig, ServerConfig)7. Create Comprehensive Config Example
Current: Config structure only in Go code
Recommended: Create
config.example.tomlwith:🔧 General Improvements
#...
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.