feat!: modernize for Go 1.26 and prepare v1.0.0 - #6
Merged
Conversation
Rework the library for Go 1.26, fix correctness bugs, add new capabilities, and align the repository structure with the slashdevops open-source layout (e5t / comparator). Correctness fixes: - Eliminate potential deadlocks in MapKeyValue caused by recursive read locking (Clone, Map, Filter, Partition, DeepEqual, SortKeys/SortValues). - Fix SMapKeyValue.Size() over-counting when overwriting existing keys. - Fix a non-atomic counter update race in SMapKeyValue. - Use sync.Map.Clear and the clear builtin instead of reallocating. New features: - All() range-over-func iterators (iter.Seq2) on both containers. - GetOrSet (atomic get-or-insert), Merge, and JSON (Marshal/Unmarshal). - Modern internals: maps, slices, clear, atomic.Int64. Breaking changes (see docs/migration.md): - Requires Go 1.26 (was 1.19). - GetAnDelete renamed to GetAndDelete. - Removed IsFull() (use !IsEmpty()) and Key() (use ContainsKey()). - SortKeys/SortValues return []K/[]T instead of []*K/[]*T. Docs & tooling: - New doc.go, extensive docs/ guides with mermaid diagrams, richer README. - Modernized Makefile, AGENTS.md, GitHub workflows (main/pr/release/codeql), dependabot, golangci config; removed gosec/codeql-analysis. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
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
Reworks RamStorage (r9e) for Go 1.26, fixes correctness bugs, adds new capabilities, and brings the repository in line with the
slashdevopsopen-source layout (e5t/comparator). This is intended as the v1.0.0 release.The library stays dependency-free (standard library only).
🐞 Correctness fixes
MapKeyValue:Clone,Map,Filter,Partition,DeepEqual, and sorting previously heldRLock()and then re-acquired it (recursive read lock, which Go warns can deadlock when a writer is waiting). They now build results under a single lock or via a snapshot.SMapKeyValue.Size()over-count fixed: the counter no longer increments when overwriting an existing key.Add(-1)(atomic.Int64) instead of a non-atomic load-then-swap.Clear()usessync.Map.Clear/ theclearbuiltin instead of reallocating.🆕 New features
All()range-over-func iterators (iter.Seq2[K, T]) on both containers.GetOrSet(atomic get-or-insert),Merge, and JSON support (MarshalJSON/UnmarshalJSON).maps,slices,clear,atomic.Int64.💥 Breaking changes (pre-1.0 → 1.0.0)
go 1.19go 1.26GetAnDeleteGetAndDeleteIsFull()!IsEmpty()Key()ContainsKey()SortKeys() []*KSortKeys() []KSortValues() []*TSortValues() []TFull before/after guide:
docs/migration.md.📚 Docs & tooling
doc.go(replacesgodoc.go); every method documented.docs/guides with mermaid diagrams (getting-started, containers, concurrency, operations, iteration, json, performance, migration, faq).README.md: full badge row, install/update viago get, API tables, mermaid, What's New / Breaking Changes.Makefile(pretty output, grouped help, lint/vulncheck/betteralign/tool-install targets).AGENTS.md(symlink →.github/copilot-instructions.md) with the post-change checklist.main/pr/release/codeql(actions v7 / codeql v4),dependabot,.golangci.yaml; removedgosecand legacycodeql-analysis.✅ Verification
🤖 Generated with Claude Code