From 5e8b2c78608ba476ff083eac1b6d9c294848c02d Mon Sep 17 00:00:00 2001 From: vyzo Date: Thu, 29 Jul 2021 08:35:53 +0300 Subject: [PATCH] make symlink helper freestanding --- blockstore/badger/blockstore.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blockstore/badger/blockstore.go b/blockstore/badger/blockstore.go index 05e9048c9..a0b51d8df 100644 --- a/blockstore/badger/blockstore.go +++ b/blockstore/badger/blockstore.go @@ -355,7 +355,7 @@ func (b *Blockstore) movingGC() error { panic(fmt.Errorf("error renaming old badger db dir from %s to %s: %w; USER ACTION REQUIRED", dbPath, backupPath, err)) //nolint } - if err = b.symlink(newPath, dbPath); err != nil { + if err = symlink(newPath, dbPath); err != nil { // same here; the db path is pointing to the void. panic and let the user fix. panic(fmt.Errorf("error symlinking new badger db dir from %s to %s: %w; USER ACTION REQUIRED", newPath, dbPath, err)) //nolint } @@ -369,7 +369,7 @@ func (b *Blockstore) movingGC() error { // symlink creates a symlink from path to linkTo; the link is relative if the two are // in the same directory -func (b *Blockstore) symlink(path, linkTo string) error { +func symlink(path, linkTo string) error { resolvedPathDir, err := filepath.EvalSymlinks(filepath.Dir(path)) if err != nil { return fmt.Errorf("error resolving links in %s: %w", path, err)