From bc9dfe4f65f5586a2edd929f4f021700a670ec3a Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 19 Sep 2024 17:01:23 +0300 Subject: [PATCH] remove redundant code --- cmd/main.go | 6 ++++++ internal/storage/storageservice.go | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 7e5bc0d..ab36f30 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -45,6 +45,12 @@ func main() { menuStorageService := storage.MenuStorageService{} + err := menuStorageService.EnsureDbDir(dbDir) + if err != nil { + fmt.Fprintf(os.Stderr, err.Error()) + os.Exit(1) + } + rs, err := menuStorageService.GetResource(scriptDir, ctx) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) diff --git a/internal/storage/storageservice.go b/internal/storage/storageservice.go index 4306153..b31b67d 100644 --- a/internal/storage/storageservice.go +++ b/internal/storage/storageservice.go @@ -31,10 +31,6 @@ type StorageService interface { type MenuStorageService struct{} func (menuStorageService *MenuStorageService) GetPersister(dbDir string, ctx context.Context) (*persist.Persister, error) { - err := ensureDbDir(dbDir) - if err != nil { - return nil, err - } store := gdbmdb.NewGdbmDb() storeFile := path.Join(dbDir, "state.gdbm") store.Connect(ctx, storeFile)