Skip to content

Commit

Permalink
fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
xiehuc committed Nov 16, 2023
1 parent 88c89b1 commit 960afe9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Changed

- Improve `go.opentelemetry.io/otel/propagation.TraceContext` 's performance (#4721)

### Removed

- Remove the deprecated `go.opentelemetry.io/otel/bridge/opencensus.NewTracer`. (#4706)
Expand Down
8 changes: 4 additions & 4 deletions propagation/trace_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) {

var sb strings.Builder
sb.Grow(2 + 32 + 16 + 2 + 3)
sb.WriteString(versionPart)
_, _ = sb.WriteString(versionPart)
traceID := sc.TraceID()
spanID := sc.SpanID()
flagByte := [1]byte{byte(flags)}
Expand All @@ -72,15 +72,15 @@ func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) {

func writeTraceParent(sb *strings.Builder, srcs ...[]byte) {
for _, src := range srcs {
sb.WriteByte(parentDelimiter[0])
_, _ = sb.WriteByte(parentDelimiter[0])

Check failure on line 75 in propagation/trace_context.go

View workflow job for this annotation

GitHub Actions / lint

assignment mismatch: 2 variables but sb.WriteByte returns 1 value (typecheck)

Check failure on line 75 in propagation/trace_context.go

View workflow job for this annotation

GitHub Actions / lint

assignment mismatch: 2 variables but sb.WriteByte returns 1 value) (typecheck)

Check failure on line 75 in propagation/trace_context.go

View workflow job for this annotation

GitHub Actions / lint

assignment mismatch: 2 variables but sb.WriteByte returns 1 value) (typecheck)

Check failure on line 75 in propagation/trace_context.go

View workflow job for this annotation

GitHub Actions / lint

assignment mismatch: 2 variables but sb.WriteByte returns 1 value) (typecheck)

Check failure on line 75 in propagation/trace_context.go

View workflow job for this annotation

GitHub Actions / lint

assignment mismatch: 2 variables but sb.WriteByte returns 1 value) (typecheck)

Check failure on line 75 in propagation/trace_context.go

View workflow job for this annotation

GitHub Actions / test-coverage

assignment mismatch: 2 variables but sb.WriteByte returns 1 value

Check failure on line 75 in propagation/trace_context.go

View workflow job for this annotation

GitHub Actions / test-bench

assignment mismatch: 2 variables but sb.WriteByte returns 1 value

Check failure on line 75 in propagation/trace_context.go

View workflow job for this annotation

GitHub Actions / compatibility-test (~1.21.3, ubuntu-latest, 386)

assignment mismatch: 2 variables but sb.WriteByte returns 1 value

Check failure on line 75 in propagation/trace_context.go

View workflow job for this annotation

GitHub Actions / compatibility-test (~1.21.3, ubuntu-latest, amd64)

assignment mismatch: 2 variables but sb.WriteByte returns 1 value

Check failure on line 75 in propagation/trace_context.go

View workflow job for this annotation

GitHub Actions / test-race

assignment mismatch: 2 variables but sb.WriteByte returns 1 value

Check failure on line 75 in propagation/trace_context.go

View workflow job for this annotation

GitHub Actions / compatibility-test (~1.20.10, ubuntu-latest, amd64)

assignment mismatch: 2 variables but sb.WriteByte returns 1 value
writeHex(sb, src)
}
}

func writeHex(sb *strings.Builder, src []byte) {
var dst [32]byte
n := hex.Encode(dst[:], src)
sb.Write(dst[:n])
_, _ = sb.Write(dst[:n])
}

// Extract reads tracecontext from the carrier into a returned Context.
Expand Down Expand Up @@ -146,7 +146,7 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
return sc
}

// upperHex detect hex is upper case
// upperHex detect hex is upper case.
func upperHex(v string) bool {
for _, c := range v {
if c >= 'A' && c <= 'F' {
Expand Down

0 comments on commit 960afe9

Please sign in to comment.