Skip to content

Commit 28c104c

Browse files
*: use new slice to array conversion syntax
Closes cockroachdb#110261. This commit adopts the new slice to array conversion syntax introduced in go 1.20. The new syntax is only applicable in one small part of the codebase, so it's a small change. From https://tip.golang.org/doc/go1.20: > Go 1.20 extends this to allow conversions from a slice to an array: > given a slice x, [4]byte(x) can now be written instead of > *(*[4]byte)(x). Release note: None
1 parent f68f0fe commit 28c104c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/util/tracing/span.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,8 @@ func SpanMetaFromProto(info tracingpb.TraceInfo) SpanMeta {
949949
// NOTE: The ugly starry expressions below can be simplified once/if direct
950950
// conversions from slices to arrays gets adopted:
951951
// https://github.com/golang/go/issues/46505
952-
traceID := *(*[16]byte)(info.Otel.TraceID)
953-
spanID := *(*[8]byte)(info.Otel.SpanID)
952+
traceID := [16]byte(info.Otel.TraceID)
953+
spanID := [8]byte(info.Otel.SpanID)
954954
otelCtx = otelCtx.WithRemote(true).WithTraceID(traceID).WithSpanID(spanID)
955955
}
956956

0 commit comments

Comments
 (0)