From 270c1f2c5a9dc08f3d0b18b6170ed0e46e5e59b7 Mon Sep 17 00:00:00 2001 From: Gautam Raj <156491596+gautam-rl@users.noreply.github.com> Date: Thu, 7 Aug 2025 14:42:32 -0700 Subject: [PATCH] gofmt --- cmd/overlaybd-snapshotter/main.go | 2 +- pkg/convertor/convertor.go | 48 ++++++++++++++--------------- pkg/convertor/trace_helpers.go | 2 +- pkg/convertor/trace_helpers_test.go | 2 +- pkg/tracing/baggage_test.go | 2 +- pkg/tracing/propagation_test.go | 2 +- pkg/utils/provenance.go | 2 +- tools.go | 2 +- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/cmd/overlaybd-snapshotter/main.go b/cmd/overlaybd-snapshotter/main.go index 1d0fca14..5fa909e6 100644 --- a/cmd/overlaybd-snapshotter/main.go +++ b/cmd/overlaybd-snapshotter/main.go @@ -53,7 +53,7 @@ func requestIDInterceptor(ctx context.Context, req interface{}, info *grpc.Unary requestID = mylog.GenerateRequestID() ctx = tracing.SetRequestID(ctx, requestID) } - + ctx = mylog.WithRequestID(ctx, requestID) ctx = log.WithLogger(ctx, log.G(ctx).WithField("req_id", requestID)) diff --git a/pkg/convertor/convertor.go b/pkg/convertor/convertor.go index 97c5a767..016d3fda 100644 --- a/pkg/convertor/convertor.go +++ b/pkg/convertor/convertor.go @@ -558,31 +558,31 @@ func (c *overlaybdConvertor) convertLayers(ctx context.Context, srcDescs []ocisp var remoteDesc ocispec.Descriptor - if c.remote { - fmt.Printf("convertLayers: Looking for remote layer\n") - span.AddEvent("remote_check_start", trace.WithAttributes( - attribute.String("host", c.host), - attribute.String("repo", c.repo), - attribute.String("chainID", chainID), - )) - - remoteDesc, err = c.findRemote(ctx, chainID) - if err != nil { - if !errdefs.IsNotFound(err) { - fmt.Printf("convertLayers: ERROR finding remote: %v\n", err) - addErrorEvent(span, err, "remote_check", desc) - return nil, err + if c.remote { + fmt.Printf("convertLayers: Looking for remote layer\n") + span.AddEvent("remote_check_start", trace.WithAttributes( + attribute.String("host", c.host), + attribute.String("repo", c.repo), + attribute.String("chainID", chainID), + )) + + remoteDesc, err = c.findRemote(ctx, chainID) + if err != nil { + if !errdefs.IsNotFound(err) { + fmt.Printf("convertLayers: ERROR finding remote: %v\n", err) + addErrorEvent(span, err, "remote_check", desc) + return nil, err + } + fmt.Printf("convertLayers: Remote layer not found, will process locally\n") + } else { + fmt.Printf("convertLayers: Found remote layer\n") } - fmt.Printf("convertLayers: Remote layer not found, will process locally\n") - } else { - fmt.Printf("convertLayers: Found remote layer\n") - } - span.AddEvent("remote_check_complete", trace.WithAttributes( - attribute.Bool("found", err == nil), - attribute.String("chainID", chainID), - )) - } + span.AddEvent("remote_check_complete", trace.WithAttributes( + attribute.Bool("found", err == nil), + attribute.String("chainID", chainID), + )) + } if c.remote && err == nil { key := fmt.Sprintf(convSnapshotNameFormat, chainID) @@ -678,7 +678,7 @@ func (c *overlaybdConvertor) applyOCIV1LayerInObd( afterApply func(root string) error, // do something after apply tar stream ) (string, error) { startTime := time.Now() - + ctx, span := tracer.Start(ctx, "applyOCIV1LayerInObd", trace.WithAttributes( attribute.String("parent_id", parentID), diff --git a/pkg/convertor/trace_helpers.go b/pkg/convertor/trace_helpers.go index 8c5c003f..96a34625 100644 --- a/pkg/convertor/trace_helpers.go +++ b/pkg/convertor/trace_helpers.go @@ -130,4 +130,4 @@ func addErrorEvent(span trace.Span, err error, operation string, desc ocispec.De attribute.String("layer_digest", desc.Digest.String()), attribute.String("error_type", getErrorType(err)), )) -} \ No newline at end of file +} diff --git a/pkg/convertor/trace_helpers_test.go b/pkg/convertor/trace_helpers_test.go index 95c3367c..8be78e94 100644 --- a/pkg/convertor/trace_helpers_test.go +++ b/pkg/convertor/trace_helpers_test.go @@ -148,4 +148,4 @@ func TestGetDiskUsage(t *testing.T) { if usage <= 0 { t.Errorf("Expected positive disk usage, got %d", usage) } -} \ No newline at end of file +} diff --git a/pkg/tracing/baggage_test.go b/pkg/tracing/baggage_test.go index 97e1cc5a..d4d9addb 100644 --- a/pkg/tracing/baggage_test.go +++ b/pkg/tracing/baggage_test.go @@ -42,4 +42,4 @@ func TestSimplifiedBaggage(t *testing.T) { if member.Value() != "test-12345" { t.Errorf("Expected baggage value 'test-12345', got '%s'", member.Value()) } -} \ No newline at end of file +} diff --git a/pkg/tracing/propagation_test.go b/pkg/tracing/propagation_test.go index 623c5276..35bda746 100644 --- a/pkg/tracing/propagation_test.go +++ b/pkg/tracing/propagation_test.go @@ -115,7 +115,7 @@ func TestTraceIDPropagation(t *testing.T) { validSpans++ } } - + if validSpans == 0 { t.Error("No valid spans found") } diff --git a/pkg/utils/provenance.go b/pkg/utils/provenance.go index 73eed8ed..c59c41a3 100644 --- a/pkg/utils/provenance.go +++ b/pkg/utils/provenance.go @@ -59,4 +59,4 @@ func IsProvenanceDescriptor(desc v1.Descriptor) bool { } return false -} \ No newline at end of file +} diff --git a/tools.go b/tools.go index 5cc5178b..e4ea64be 100644 --- a/tools.go +++ b/tools.go @@ -5,4 +5,4 @@ package tools import ( _ "gotest.tools/gotestsum" -) \ No newline at end of file +)