Skip to content

Commit

Permalink
fix up
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Yuan <[email protected]>
  • Loading branch information
SamYuan1990 committed Sep 20, 2024
1 parent 7553fb5 commit 6ba7b10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions pkg/infra/basic/logger.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package basic

import (
"fmt"
"io"
"sync"
"time"
Expand Down Expand Up @@ -75,7 +74,7 @@ type TracingSpans struct {
}

func (TS *TracingSpans) MakeSpan(txid, address, event string, parent opentracing.Span) opentracing.Span {
str := fmt.Sprintf(event + address)
str := event + address
if parent == nil {
return opentracing.GlobalTracer().StartSpan(str, opentracing.Tag{Key: "txid", Value: txid})
} else {
Expand All @@ -87,7 +86,7 @@ func (TS *TracingSpans) GetSpan(txid, address, event string) opentracing.Span {
TS.Lock.Lock()
defer TS.Lock.Unlock()

str := fmt.Sprintf(event + txid + address)
str := event + txid + address
span, ok := TS.Spans[str]
if ok {
return span
Expand All @@ -99,7 +98,7 @@ func (TS *TracingSpans) SpanIntoMap(txid, address, event string, parent opentrac
TS.Lock.Lock()
defer TS.Lock.Unlock()

str := fmt.Sprintf(event + txid + address)
str := event + txid + address
span, ok := TS.Spans[str]
if !ok {
span = TS.MakeSpan(txid, address, event, parent)
Expand All @@ -112,7 +111,7 @@ func (TS *TracingSpans) FinishWithMap(txid, address, event string) {
TS.Lock.Lock()
defer TS.Lock.Unlock()

str := fmt.Sprintf(event + txid + address)
str := event + txid + address
span, ok := TS.Spans[str]
if ok {
span.Finish()
Expand Down
4 changes: 2 additions & 2 deletions pkg/infra/trafficGenerator/fuzzing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ func FuzzConvertString(f *testing.F) {
f.Fuzz(func(t *testing.T, orig string) {
data, err := trafficGenerator.ConvertString(orig)
if utf8.ValidString(orig) && err != nil && !utf8.ValidString(data) && len(data) != 0 {
t.Errorf(err.Error() + " " + orig + " " + data)
t.Error(err.Error() + " " + orig + " " + data)
}
if !utf8.ValidString(data) {
t.Errorf("fail to convert utf8 string" + data)
t.Error("fail to convert utf8 string" + data)
}
})
}

0 comments on commit 6ba7b10

Please sign in to comment.