From 08ca189b1df35521b80d91789f07077fdbda5473 Mon Sep 17 00:00:00 2001 From: Sam Yuan Date: Fri, 20 Sep 2024 08:25:18 +0800 Subject: [PATCH 1/4] bump up to go 1.23 Signed-off-by: Sam Yuan --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 03383087..abcaa321 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/hyperledger-twgc/tape -go 1.21 +go 1.23 require ( github.com/gogo/protobuf v1.3.2 From 71e2cd1753741f02c2c81d06a49605ddcfbdf059 Mon Sep 17 00:00:00 2001 From: Sam Yuan Date: Fri, 20 Sep 2024 08:28:43 +0800 Subject: [PATCH 2/4] fix up Signed-off-by: Sam Yuan --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a5691226..173abb4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu as tape-base -FROM golang:1.21 as golang +FROM golang:1.23 as golang WORKDIR /root From 7553fb57a4615536c829ecf3464f28dd93c70c89 Mon Sep 17 00:00:00 2001 From: Sam Yuan Date: Fri, 20 Sep 2024 08:36:26 +0800 Subject: [PATCH 3/4] fix lint Signed-off-by: Sam Yuan --- .github/workflows/golangci-lint.yml | 2 +- cmd/tape/main.go | 2 +- internal/fabric/core/comm/client.go | 2 +- pkg/infra/basic/config.go | 2 +- pkg/infra/basic/logger.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 2d5e50f8..bf1e155f 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -18,5 +18,5 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.55.2 + version: v1.61.0 skip-pkg-cache: true \ No newline at end of file diff --git a/cmd/tape/main.go b/cmd/tape/main.go index a3615040..d96a1e71 100644 --- a/cmd/tape/main.go +++ b/cmd/tape/main.go @@ -9,7 +9,7 @@ import ( "github.com/pkg/errors" log "github.com/sirupsen/logrus" - "gopkg.in/alecthomas/kingpin.v2" + kingpin "gopkg.in/alecthomas/kingpin.v2" ) const ( diff --git a/internal/fabric/core/comm/client.go b/internal/fabric/core/comm/client.go index 30f3fdfc..fd541ff4 100644 --- a/internal/fabric/core/comm/client.go +++ b/internal/fabric/core/comm/client.go @@ -13,7 +13,7 @@ import ( grpc_opentracing "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing" - "github.com/opentracing/opentracing-go" + opentracing "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" diff --git a/pkg/infra/basic/config.go b/pkg/infra/basic/config.go index 0a72649f..4db6b385 100644 --- a/pkg/infra/basic/config.go +++ b/pkg/infra/basic/config.go @@ -16,7 +16,7 @@ import ( "github.com/hyperledger/fabric-protos-go-apiv2/msp" "github.com/hyperledger/fabric-protos-go-apiv2/peer" "github.com/pkg/errors" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" ) type TracingProposal struct { diff --git a/pkg/infra/basic/logger.go b/pkg/infra/basic/logger.go index f6cfdc89..31eeb127 100644 --- a/pkg/infra/basic/logger.go +++ b/pkg/infra/basic/logger.go @@ -9,7 +9,7 @@ import ( "github.com/opentracing/opentracing-go" "github.com/prometheus/client_golang/prometheus" log "github.com/sirupsen/logrus" - "github.com/uber/jaeger-client-go" + jaeger "github.com/uber/jaeger-client-go" "github.com/uber/jaeger-client-go/config" ) From 6ba7b104bde349d43c10d3b5fac866a9d28005ba Mon Sep 17 00:00:00 2001 From: Sam Yuan Date: Fri, 20 Sep 2024 08:46:20 +0800 Subject: [PATCH 4/4] fix up Signed-off-by: Sam Yuan --- pkg/infra/basic/logger.go | 9 ++++----- pkg/infra/trafficGenerator/fuzzing_test.go | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/infra/basic/logger.go b/pkg/infra/basic/logger.go index 31eeb127..bcdbdc3a 100644 --- a/pkg/infra/basic/logger.go +++ b/pkg/infra/basic/logger.go @@ -1,7 +1,6 @@ package basic import ( - "fmt" "io" "sync" "time" @@ -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 { @@ -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 @@ -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) @@ -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() diff --git a/pkg/infra/trafficGenerator/fuzzing_test.go b/pkg/infra/trafficGenerator/fuzzing_test.go index 3e84cdff..e09755ec 100644 --- a/pkg/infra/trafficGenerator/fuzzing_test.go +++ b/pkg/infra/trafficGenerator/fuzzing_test.go @@ -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) } }) }