refactor: use maps.Copy for cleaner map handling#6283
refactor: use maps.Copy for cleaner map handling#6283ehsandeep merged 1 commit intoprojectdiscovery:devfrom
Conversation
WalkthroughThe changes replace manual map copying loops with the standard library's Changes
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (15)
✅ Files skipped from review due to trivial changes (4)
🚧 Files skipped from review as they are similar to previous changes (11)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
dwisiswant0
left a comment
There was a problem hiding this comment.
Scanned it with Semgrep, found a few more! Could you also update the following occurrences?
pkg/protocols/common/generators/generators.go
❯❱ tmp.use-maps-copy-instead
Use maps.Copy instead
35┆ for k, v := range values {
36┆ payloadsFinal[k] = v
37┆ }
pkg/protocols/common/generators/maps.go
❯❱ tmp.use-maps-copy-instead
Use maps.Copy instead
50┆ for k, v := range m {
51┆ merged[k] = v
52┆ }
pkg/protocols/common/helpers/eventcreator/eventcreator.go
❯❱ tmp.use-maps-copy-instead
Use maps.Copy instead
36┆ for k, v := range result.DynamicValues {
37┆ event.InternalEvent[k] = v
38┆ }
pkg/protocols/dns/request.go
❯❱ tmp.use-maps-copy-instead
Use maps.Copy instead
184┆ for k, v := range previous {
185┆ outputEvent[k] = v
186┆ }
⋮┆----------------------------------------
187┆ for k, v := range vars {
188┆ outputEvent[k] = v
189┆ }
pkg/protocols/file/request.go
❯❱ tmp.use-maps-copy-instead
Use maps.Copy instead
265┆ for k, v := range previous {
266┆ dslMap[k] = v
267┆ }
⋮┆----------------------------------------
336┆ for k, v := range previous {
337┆ internalEvent[k] = v
338┆ }
pkg/protocols/http/operators.go
❯❱ tmp.use-maps-copy-instead
Use maps.Copy instead
111┆ for k, v := range extra {
112┆ data[k] = v
113┆ }
pkg/protocols/http/request.go
❯❱ tmp.use-maps-copy-instead
Use maps.Copy instead
972┆ for k, v := range previousEvent {
973┆ finalEvent[k] = v
974┆ }
⋮┆----------------------------------------
975┆ for k, v := range outputEvent {
976┆ finalEvent[k] = v
977┆ }
pkg/protocols/javascript/js.go
❯❱ tmp.use-maps-copy-instead
Use maps.Copy instead
306┆ for k, v := range dynamicValues {
307┆ payloadValues[k] = v
308┆ }
⋮┆----------------------------------------
615┆ for k, v := range values {
616┆ data[k] = v
617┆ }
pkg/protocols/network/request.go
❯❱ tmp.use-maps-copy-instead
Use maps.Copy instead
376┆ for k, v := range values {
377┆ payloads[k] = v
378┆ }
⋮┆----------------------------------------
428┆ for k, v := range previous {
429┆ outputEvent[k] = v
430┆ }
⋮┆----------------------------------------
431┆ for k, v := range interimValues {
432┆ outputEvent[k] = v
433┆ }
⋮┆----------------------------------------
434┆ for k, v := range inputEvents {
435┆ outputEvent[k] = v
436┆ }
pkg/protocols/offlinehttp/operators.go
❯❱ tmp.use-maps-copy-instead
Use maps.Copy instead
106┆ for k, v := range extra {
107┆ data[k] = v
108┆ }
pkg/protocols/ssl/ssl.go
❯❱ tmp.use-maps-copy-instead
Use maps.Copy instead
208┆ for k, v := range dynamicValues {
209┆ payloadValues[k] = v
210┆ }
⋮┆----------------------------------------
273┆ for k, v := range payloadValues {
274┆ data[k] = v
275┆ }
pkg/protocols/websocket/websocket.go
❯❱ tmp.use-maps-copy-instead
Use maps.Copy instead
275┆ for k, v := range previous {
276┆ data[k] = v
277┆ }
⋮┆----------------------------------------
278┆ for k, v := range events {
279┆ data[k] = v
280┆ }
⋮┆----------------------------------------
338┆ for k, v := range values {
339┆ inputEvents[k] = v
340┆ }
Thanks for your help! Modified. Please review again. |
Signed-off-by: gopherorg <gopherworld@icloud.com>
|
I have resolve the conflict. Please review again. |
Signed-off-by: gopherorg <gopherworld@icloud.com>
Proposed changes
There is a new function added in the go1.21 standard library, which can make the code more concise and easy to read.
Checklist
Summary by CodeRabbit