Skip to content

refactor: simplify merge function using maps.Copy from Go 1.21+#244

Open
slightsharp wants to merge 1 commit intovulpemventures:masterfrom
slightsharp:master
Open

refactor: simplify merge function using maps.Copy from Go 1.21+#244
slightsharp wants to merge 1 commit intovulpemventures:masterfrom
slightsharp:master

Conversation

@slightsharp
Copy link
Copy Markdown

There is a new function added in the go1.21 standard library, which can make the code more concise and easy to read.

Signed-off-by: slightsharp <slightsharp@outlook.com>
@slightsharp
Copy link
Copy Markdown
Author

@tiero Hi, Could you please review this PR at your convenience? Thank you very much.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the internal state map-merging helper to use the standard library’s maps.Copy utility (Go 1.21+), reducing manual loop code while preserving behavior.

Changes:

  • Replace the manual key-by-key merge loop with maps.Copy.
  • Rename the variadic parameter from maps to sources and the local accumulator from merge to result to avoid naming collisions and improve clarity.
  • Add the maps standard library import.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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