Add ComparableMap type, improve doc comments, and update tooling#6
Merged
Merged
Conversation
|
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. |
f866b61 to
254980a
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a new ComparableMap type to provide compile-time safety for CompareAndDelete/CompareAndSwap, expands API documentation/examples, and updates repo tooling/CI for a more standardized developer workflow.
Changes:
- Add
ComparableMap[Key, Value comparable]and deprecate the unsafeMapcompare operations. - Add/refresh docs and examples (package docs, README, example tests) plus comprehensive unit/concurrency tests.
- Modernize tooling (Go version bump, golangci-lint config, Makefile simplification, mise/devcontainer, GitHub Actions workflows).
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| comparable_map.go | Adds ComparableMap wrapper intended to enforce comparability for CAS/CAD operations. |
| map.go | Adds package/type/method doc comments; deprecates Map compare methods with guidance. |
| map_test.go | Adds unit + concurrent tests for both Map and ComparableMap. |
| map_example_test.go | Updates examples to use ComparableMap for compare operations; minor callback cleanup. |
| README.md | Adds clearer type descriptions and a ComparableMap quick-start snippet. |
| go.mod | Bumps Go version directive to 1.24.0. |
| Makefile | Simplifies lint/test targets; adds fix via golangci-lint. |
| .golangci.yaml | Adds golangci-lint v2 configuration. |
| mise.toml | Replaces asdf tool versions with mise-managed tool pins. |
| .tool-versions | Removes asdf tool-version file. |
| .github/workflows/pr-check.yml | Adds PR lint+test workflow using mise + make. |
| .github/workflows/codeql.yml | Adds CodeQL workflow for Go analysis. |
| .devcontainer/devcontainer.json | Adds devcontainer definition for consistent environment setup. |
| .devcontainer/post_create.sh | Sets up mise + installs dev tools inside devcontainer. |
| .vscode/settings.json | Adds VS Code Go tooling settings aligned with golangci-lint v2. |
| AGENTS.md | Adds development and contribution guidelines for agents. |
| tools/tools.go | Removes tools module tooling file (gofumpt). |
| tools/go.mod | Removes tools module go.mod. |
| tools/go.sum | Removes tools module go.sum. |
| .agents/skills/**/SKILL.md | Adds agent skill documentation files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Add a new
ComparableMaptype that requires the value type to implementcomparable, providing safeCompareAndDeleteandCompareAndSwapoperations without risk of runtime panic.Changes
New Features
ComparableMap[Key, Value comparable]: A drop-in replacement forMapwhenCompareAndDeleteorCompareAndSwapis needed. Enforces comparability at compile time.CompareAndDeleteandCompareAndSwaponMapare now explicitly deprecated with clear guidance to useComparableMapinstead.Documentation
map.goexplaining both types.Map.README.mdwith clearer descriptions, aComparableMapquick-start example, and aTypessection.Tooling & Infrastructure
1.24.0ingo.mod.Makefile: removed dependency ongofumpt/tools/module;lintnow runsgolangci-lint -v,testruns with-race -failfast..tool-versionswithmise.toml..golangci.yamllinter config.pr-check.yml,codeql.yml).AGENTS.mdwith development guidelines.map_test.gowith unit tests (race-detector enabled).