[#1606] Use slices.Clone()/bytes.Clone() where possible
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 28s
DCO action / DCO (pull_request) Successful in 42s
Vulncheck / Vulncheck (pull_request) Successful in 1m0s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m33s
Build / Build Components (pull_request) Successful in 1m46s
Tests and linters / Staticcheck (pull_request) Successful in 2m0s
Tests and linters / Lint (pull_request) Successful in 2m55s
Tests and linters / Tests (pull_request) Successful in 4m17s
Tests and linters / Tests with -race (pull_request) Successful in 5m14s
Tests and linters / gopls check (pull_request) Successful in 5m17s
Tests and linters / Run gofumpt (push) Successful in 27s
Vulncheck / Vulncheck (push) Successful in 51s
Pre-commit hooks / Pre-commit (push) Successful in 1m25s
Build / Build Components (push) Successful in 2m10s
Tests and linters / Staticcheck (push) Successful in 2m25s
Tests and linters / Lint (push) Successful in 3m24s
Tests and linters / Tests (push) Successful in 4m4s
OCI image / Build container images (push) Successful in 4m21s
Tests and linters / Tests with -race (push) Successful in 4m25s
Tests and linters / gopls check (push) Successful in 4m49s
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 28s
DCO action / DCO (pull_request) Successful in 42s
Vulncheck / Vulncheck (pull_request) Successful in 1m0s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m33s
Build / Build Components (pull_request) Successful in 1m46s
Tests and linters / Staticcheck (pull_request) Successful in 2m0s
Tests and linters / Lint (pull_request) Successful in 2m55s
Tests and linters / Tests (pull_request) Successful in 4m17s
Tests and linters / Tests with -race (pull_request) Successful in 5m14s
Tests and linters / gopls check (pull_request) Successful in 5m17s
Tests and linters / Run gofumpt (push) Successful in 27s
Vulncheck / Vulncheck (push) Successful in 51s
Pre-commit hooks / Pre-commit (push) Successful in 1m25s
Build / Build Components (push) Successful in 2m10s
Tests and linters / Staticcheck (push) Successful in 2m25s
Tests and linters / Lint (push) Successful in 3m24s
Tests and linters / Tests (push) Successful in 4m4s
OCI image / Build container images (push) Successful in 4m21s
Tests and linters / Tests with -race (push) Successful in 4m25s
Tests and linters / gopls check (push) Successful in 4m49s
gopatch: ``` @@ var from, to expression @@ +import "bytes" -to := make([]byte, len(from)) -copy(to, from) +to := bytes.Clone(from) @@ var from, to expression @@ +import "bytes" -to = make([]byte, len(from)) -copy(to, from) +to = bytes.Clone(from) @@ var from, to, typ expression @@ +import "slices" -to := make([]typ, len(from)) -copy(to, from) +to := slices.Clone(from) @@ var from, to, typ expression @@ +import "slices" -to = make([]typ, len(from)) -copy(to, from) +to = slices.Clone(from) ``` Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
80de5d70bf
commit
c98357606b
11 changed files with 21 additions and 24 deletions
|
@ -2,6 +2,7 @@ package client
|
|||
|
||||
import (
|
||||
"context"
|
||||
"slices"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
|
@ -99,8 +100,7 @@ mainLoop:
|
|||
case <-t.C:
|
||||
c.switchLock.RLock()
|
||||
|
||||
endpointsCopy := make([]Endpoint, len(c.endpoints.list))
|
||||
copy(endpointsCopy, c.endpoints.list)
|
||||
endpointsCopy := slices.Clone(c.endpoints.list)
|
||||
currPriority := c.endpoints.list[c.endpoints.curr].Priority
|
||||
highestPriority := c.endpoints.list[0].Priority
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue