Skip to content

feat!: modernize for Go 1.26 and prepare v1.0.0 - #6

Merged
christiangda merged 1 commit into
mainfrom
feat/go-1.26-modernization
Jul 23, 2026
Merged

feat!: modernize for Go 1.26 and prepare v1.0.0#6
christiangda merged 1 commit into
mainfrom
feat/go-1.26-modernization

Conversation

@christiangda

Copy link
Copy Markdown
Contributor

Summary

Reworks RamStorage (r9e) for Go 1.26, fixes correctness bugs, adds new capabilities, and brings the repository in line with the slashdevops open-source layout (e5t / comparator). This is intended as the v1.0.0 release.

The library stays dependency-free (standard library only).

🐞 Correctness fixes

  • Deadlocks removed in MapKeyValue: Clone, Map, Filter, Partition, DeepEqual, and sorting previously held RLock() 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.
  • Counter race fixed: decrements now use an atomic Add(-1) (atomic.Int64) instead of a non-atomic load-then-swap.
  • Clear() uses sync.Map.Clear / the clear builtin 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).
  • Modern stdlib internals: maps, slices, clear, atomic.Int64.

💥 Breaking changes (pre-1.0 → 1.0.0)

Before After
go 1.19 go 1.26
GetAnDelete GetAndDelete
IsFull() removed — use !IsEmpty()
Key() removed — use ContainsKey()
SortKeys() []*K SortKeys() []K
SortValues() []*T SortValues() []T

Full before/after guide: docs/migration.md.

📚 Docs & tooling

  • New doc.go (replaces godoc.go); every method documented.
  • Extensive docs/ guides with mermaid diagrams (getting-started, containers, concurrency, operations, iteration, json, performance, migration, faq).
  • Richer README.md: full badge row, install/update via go get, API tables, mermaid, What's New / Breaking Changes.
  • Modernized Makefile (pretty output, grouped help, lint/vulncheck/betteralign/tool-install targets).
  • AGENTS.md (symlink → .github/copilot-instructions.md) with the post-change checklist.
  • GitHub Actions: main / pr / release / codeql (actions v7 / codeql v4), dependabot, .golangci.yaml; removed gosec and legacy codeql-analysis.

✅ Verification

go vet ./...      # clean
go test -race ...  # PASS — coverage 97.8%
go build ./...    # OK

🤖 Generated with Claude Code

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>
@christiangda christiangda self-assigned this Jul 23, 2026
@github-advanced-security

Copy link
Copy Markdown

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:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@christiangda
christiangda merged commit a39b076 into main Jul 23, 2026
4 checks passed
@christiangda
christiangda deleted the feat/go-1.26-modernization branch July 23, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants