Fix warnings reported by Go 1.6 "go tool vet -shadow=true"

Warnings were:

  main.go:234: declaration of err shadows declaration at main.go:163:
  internal/fusefrontend/file.go:401: declaration of err shadows declaration at internal/fusefrontend/file.go:379:
  internal/fusefrontend/file.go:419: declaration of err shadows declaration at internal/fusefrontend/file.go:379:
  internal/fusefrontend/fs_dir.go:140: declaration of err shadows declaration at internal/fusefrontend/fs_dir.go:97:
This commit is contained in:
Jakob Unterwurzacher 2016-06-14 22:45:33 +02:00
parent 620dba30c4
commit 393e531afd
3 changed files with 6 additions and 5 deletions

View File

@ -361,10 +361,11 @@ func (f *file) Truncate(newSize uint64) fuse.Status {
}
wlock.lock(f.ino)
defer wlock.unlock(f.ino)
var err error
// Common case first: Truncate to zero
if newSize == 0 {
err := syscall.Ftruncate(int(f.fd.Fd()), 0)
err = syscall.Ftruncate(int(f.fd.Fd()), 0)
if err != nil {
toggledlog.Warn.Printf("ino%d fh%d: Ftruncate(fd, 0) returned error: %v", f.ino, f.intFd(), err)
return fuse.ToStatus(err)
@ -398,7 +399,7 @@ func (f *file) Truncate(newSize uint64) fuse.Status {
// File was empty, create new header
if oldSize == 0 {
err := f.createHeader()
err = f.createHeader()
if err != nil {
return fuse.ToStatus(err)
}
@ -416,7 +417,7 @@ func (f *file) Truncate(newSize uint64) fuse.Status {
}
} else {
off, length := b.CiphertextRange()
err := syscall.Ftruncate(int(f.fd.Fd()), int64(off+length))
err = syscall.Ftruncate(int(f.fd.Fd()), int64(off+length))
if err != nil {
toggledlog.Warn.Printf("grow Ftruncate returned error: %v", err)
return fuse.ToStatus(err)

View File

@ -137,7 +137,7 @@ func (fs *FS) Rmdir(path string, context *fuse.Context) (code fuse.Status) {
// Undo the chmod if removing the directory failed
defer func() {
if code != fuse.OK {
err := os.Chmod(cPath, origMode)
err = os.Chmod(cPath, origMode)
if err != nil {
toggledlog.Warn.Printf("Rmdir: Chmod rollback failed: %v", err)
}

View File

@ -231,7 +231,7 @@ func main() {
// Every operation below requires CIPHERDIR. Check that we have it.
if flagSet.NArg() >= 1 {
args.cipherdir, _ = filepath.Abs(flagSet.Arg(0))
err := checkDir(args.cipherdir)
err = checkDir(args.cipherdir)
if err != nil {
toggledlog.Fatal.Printf(colorRed+"Invalid cipherdir: %v\n"+colorReset, err)
os.Exit(ERREXIT_CIPHERDIR)