Skip to content

Conversation

@rubensantoniorosa2704
Copy link

Replaces a manual slice copy loop with Go's built-in copy() function to fix the staticcheck S1001 linter warning.

Before:

fields := make([]Field, len(s.Fields))
for i, f := range s.Fields {
    fields[i] = f
}

After:

fields := make([]Field, len(s.Fields))
copy(fields, s.Fields)

Why:

  • Idiomatic Go code
  • Fixes linter warning: "should use copy(to, from) instead of a loop"
  • No functional changes, just optimization
Replaces manual slice copy loop with built-in copy() function
to fix S1001 linter warning: should use copy(to, from) instead of a loop.
@rubensantoniorosa2704 rubensantoniorosa2704 marked this pull request as ready for review November 1, 2025 00:25
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🔧 golang labels Nov 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files. 🔧 golang

1 participant