Upgrade toml to v1.6.0 with metadata validation and enhanced error reporting#383
Upgrade toml to v1.6.0 with metadata validation and enhanced error reporting#383
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
|
@copilot please fix this linting error Running [/home/runner/golangci-lint-2.8.0-linux-amd64/golangci-lint run --timeout=5m] in [/home/runner/work/gh-aw-mcpg/gh-aw-mcpg] ...
Error: issues found |
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Fixed in commit 7164555. Changed Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
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.