From 43fd3d9fd43cbba43552582a8f689802560266a0 Mon Sep 17 00:00:00 2001 From: gopherorg Date: Sun, 20 Jul 2025 15:48:32 +0800 Subject: [PATCH] refactor: use maps.Copy for cleaner map handling Signed-off-by: gopherorg --- CHANGELOG.md | 1 + app/app.go | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dbb2af08..2d09947e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Improvements - [#1169](https://github.com/crypto-org-chain/chain-main/pull/1169) Update linter and tidy up code +- [#1170](https://github.com/crypto-org-chain/chain-main/pull/1170) Use maps.Copy for cleaner map handling *July 9, 2025* diff --git a/app/app.go b/app/app.go index c57ef7348..14d1cd07c 100644 --- a/app/app.go +++ b/app/app.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "io/fs" + "maps" "net/http" "os" "path/filepath" @@ -1010,9 +1011,7 @@ func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) { // GetMaccPerms returns a copy of the module account permissions func GetMaccPerms() map[string][]string { dupMaccPerms := make(map[string][]string) - for k, v := range maccPerms { - dupMaccPerms[k] = v - } + maps.Copy(dupMaccPerms, maccPerms) return dupMaccPerms }