refactor: replace hand-rolled INI parser with gopkg.in/ini.v1#1
Merged
refactor: replace hand-rolled INI parser with gopkg.in/ini.v1#1
Conversation
The custom line-based INI parser had a slice aliasing bug in replaceSection() — when replacing a section with more keys than the original, append() mutated the underlying array and corrupted sections below. Rather than patching the bug, replace the parser entirely with the battle-tested gopkg.in/ini.v1 library. The exported API (iniFile struct + all methods) is preserved so config.go needs only a single change (len(ini.lines) == 0 → isEmpty()). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
gopkg.in/ini.v1to fix a slice aliasing bug inreplaceSection()that corrupted sections below when the replacement had more keys than the originaliniFilestruct + all methods) soconfig.goneeds only a one-line changeTest plan
go test ./...passes[default]and large[profile dev], switch to dev, verify all sections preserved