Skip to content

Commit 3351414

Browse files
committed
Fixing govet -shadow
1 parent 10324de commit 3351414

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

internal/postgresql/postgresql.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"errors"
2121
"fmt"
2222
"io"
23+
"io/fs"
2324
"io/ioutil"
2425
"os"
2526
"os/exec"
@@ -331,7 +332,8 @@ func (p *Manager) moveWal() (err error) {
331332
return err
332333
}
333334
log.Debugf("moving WAL files from %s to %s", curPath, tmpPath)
334-
if entries, err := ioutil.ReadDir(curPath); err != nil {
335+
var entries []fs.FileInfo
336+
if entries, err = ioutil.ReadDir(curPath); err != nil {
335337
log.Errorf("could not read contents of folder %s: %e", curPath, err)
336338
return err
337339
} else {
@@ -346,7 +348,8 @@ func (p *Manager) moveWal() (err error) {
346348
}
347349
}
348350

349-
if symlinkStat, err := os.Lstat(symlinkPath); err != nil {
351+
var symlinkStat fs.FileInfo
352+
if symlinkStat, err = os.Lstat(symlinkPath); err != nil {
350353
log.Errorf("could not get info on current pg_wal folder/symlink %s: %e", symlinkPath, err)
351354
return err
352355
} else if symlinkStat.Mode()&os.ModeSymlink != 0 {
@@ -355,12 +358,12 @@ func (p *Manager) moveWal() (err error) {
355358
return err
356359
}
357360
} else if symlinkStat.IsDir() {
358-
if err := syscall.Rmdir(symlinkPath); err != nil {
361+
if err = syscall.Rmdir(symlinkPath); err != nil {
359362
log.Errorf("could not remove current folder %s: %e", symlinkPath, err)
360363
return err
361364
}
362365
} else {
363-
err := fmt.Errorf("location %s is no symlink and no dir, so please check and resolve by hand", symlinkPath)
366+
err = fmt.Errorf("location %s is no symlink and no dir, so please check and resolve by hand", symlinkPath)
364367
log.Error(err)
365368
return err
366369
}

0 commit comments

Comments
 (0)