remove redundant code

This commit is contained in:
Carlosokumu 2024-09-19 17:01:23 +03:00
parent ffa00ae15c
commit bc9dfe4f65
Signed by: carlos
GPG Key ID: 7BD6BC8160A5C953
2 changed files with 6 additions and 4 deletions

View File

@ -45,6 +45,12 @@ func main() {
menuStorageService := storage.MenuStorageService{} 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) rs, err := menuStorageService.GetResource(scriptDir, ctx)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, err.Error()) fmt.Fprintf(os.Stderr, err.Error())

View File

@ -31,10 +31,6 @@ type StorageService interface {
type MenuStorageService struct{} type MenuStorageService struct{}
func (menuStorageService *MenuStorageService) GetPersister(dbDir string, ctx context.Context) (*persist.Persister, error) { func (menuStorageService *MenuStorageService) GetPersister(dbDir string, ctx context.Context) (*persist.Persister, error) {
err := ensureDbDir(dbDir)
if err != nil {
return nil, err
}
store := gdbmdb.NewGdbmDb() store := gdbmdb.NewGdbmDb()
storeFile := path.Join(dbDir, "state.gdbm") storeFile := path.Join(dbDir, "state.gdbm")
store.Connect(ctx, storeFile) store.Connect(ctx, storeFile)