Skip to content

Commit 0565ca2

Browse files
authored
chore: enable rangeValCopy from go-critic (#7438)
<!-- !! Please DELETE this comment before posting. We appreciate your contribution to the Jaeger project! πŸ‘‹πŸŽ‰ --> ## Which problem is this PR solving? - enable rangeValCopy from go-critic ## Description of the changes - ## How was this change tested? - ## Checklist - [ ] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [ ] I have signed all commits - [ ] I have added unit tests for the new functionality - [ ] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
1 parent 022a5ea commit 0565ca2

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

β€Ž.golangci.ymlβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ linters:
7474
- hugeParam
7575
- importShadow
7676
- paramTypeCombine # WON'T FIX
77-
- rangeValCopy
7877
- returnAfterHttpError
7978
- todoCommentWithoutDetail
8079
- unnamedResult

β€Žcmd/anonymizer/main.goβ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ func main() {
6666
logger.Error("Failed to close grpc client connection", zap.Error(err))
6767
}
6868

69-
for _, span := range spans {
70-
if err := w.WriteSpan(&span); err != nil {
69+
for i := range spans {
70+
span := &spans[i]
71+
if err := w.WriteSpan(span); err != nil {
7172
if errors.Is(err, writer.ErrMaxSpansCountReached) {
7273
logger.Info("max spans count reached")
7374
os.Exit(0)

β€Žinternal/storage/v1/grpc/shared/grpc_client.goβ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,14 @@ func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery
152152
return nil, fmt.Errorf("stream error: %w", err)
153153
}
154154

155-
for i, span := range received.Spans {
155+
for i := range received.Spans {
156+
span := &received.Spans[i]
156157
if trace == nil || span.TraceID != traceID {
157158
trace = &model.Trace{}
158159
traceID = span.TraceID
159160
traces = append(traces, trace)
160161
}
161-
trace.Spans = append(trace.Spans, &received.Spans[i])
162+
trace.Spans = append(trace.Spans, span)
162163
}
163164
}
164165
return traces, nil

β€Žinternal/storage/v2/clickhouse/tracestore/dbmodel/to_dbmodel.goβ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ func (link *LinkColumnSet) linkInput() proto.Input {
441441
func (acm attributeColumnsMap) attributesInput() proto.Input {
442442
var result []proto.InputColumn
443443
for _, pair := range acm {
444-
result = append(result,
444+
result = append(result,
445445
input(pair.keyColName, pair.keyCol),
446446
input(pair.valueColName, pair.valueCol),
447447
)
@@ -476,7 +476,8 @@ func (acm attributeColumnsMap) appendNestedAttributeGroup(nestedGroup NestedAttr
476476
var strValues [][]string
477477
var bytesKeys [][]string
478478
var bytesValues [][]string
479-
for _, group := range nestedGroup.AttributesGroups {
479+
for i := range nestedGroup.AttributesGroups {
480+
group := &nestedGroup.AttributesGroups[i]
480481
boolKeys = append(boolKeys, group.BoolKeys)
481482
boolValues = append(boolValues, group.BoolValues)
482483
doubleKeys = append(doubleKeys, group.DoubleKeys)

0 commit comments

Comments
Β (0)