From ac458e526f1d87813bb64466757c68d2ea111862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Thu, 7 May 2026 15:10:19 +0400 Subject: [PATCH] Format multiline calls in geoloc service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- pkg/geoloc/service.go | 44 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/pkg/geoloc/service.go b/pkg/geoloc/service.go index b58770956..eb4e65010 100644 --- a/pkg/geoloc/service.go +++ b/pkg/geoloc/service.go @@ -77,34 +77,34 @@ func (s *Service) ImportFromDir(ctx context.Context, dataDir string) error { } } - if err := s.pgClient.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error { - if err := coredata.CreateIPCountryBlocksStaging(ctx, conn); err != nil { - return fmt.Errorf("cannot create staging table: %w", err) - } + if err := s.pgClient.WithConn( + ctx, + func(ctx context.Context, conn pg.Querier) error { + if err := coredata.CreateIPCountryBlocksStaging(ctx, conn); err != nil { + return fmt.Errorf("cannot create staging table: %w", err) + } - if err := coredata.CopyIPCountryBlocksStaging(ctx, conn, blocks); err != nil { - return fmt.Errorf("cannot copy IP country blocks to staging: %w", err) - } + if err := coredata.CopyIPCountryBlocksStaging(ctx, conn, blocks); err != nil { + return fmt.Errorf("cannot copy IP country blocks to staging: %w", err) + } - if err := coredata.FinalizeIPCountryBlocksStaging(ctx, conn); err != nil { - return fmt.Errorf("cannot finalize staging table: %w", err) - } + if err := coredata.FinalizeIPCountryBlocksStaging(ctx, conn); err != nil { + return fmt.Errorf("cannot finalize staging table: %w", err) + } - return nil - }); err != nil { - _ = s.pgClient.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error { - return coredata.DropIPCountryBlocksStaging(ctx, conn) - }) + return nil + }, + ); err != nil { return err } - if err := s.pgClient.WithTx(ctx, func(ctx context.Context, tx pg.Tx) error { - return coredata.SwapIPCountryBlocksStaging(ctx, tx) - }); err != nil { - _ = s.pgClient.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error { - return coredata.DropIPCountryBlocksStaging(ctx, conn) - }) - return fmt.Errorf("cannot swap staging table: %w", err) + if err := s.pgClient.WithTx( + ctx, + func(ctx context.Context, tx pg.Tx) error { + return fmt.Errorf("cannot swap staging table: %w", err) + }, + ); err != nil { + return err } return nil