Run go fmt

This commit is contained in:
Jakob Unterwurzacher 2015-11-27 22:20:01 +01:00
parent 6acd772cf9
commit a04a92cdab
6 changed files with 20 additions and 21 deletions

View File

@ -9,16 +9,16 @@ import (
// readDirIV - read the "gocryptfs.diriv" file from "dir" (absolute path)
func (be *CryptFS) readDirIV(dir string) (iv []byte, err error) {
ivfile := filepath.Join(dir, DIRIV_FILENAME)
iv, err = ioutil.ReadFile(ivfile)
if err != nil {
Warn.Printf("readDirIV: %v\n", err)
return nil, err
}
if len(iv) != DIRIV_LEN {
return nil, fmt.Errorf("readDirIV: Invalid length %d\n", len(iv))
}
return iv, nil
ivfile := filepath.Join(dir, DIRIV_FILENAME)
iv, err = ioutil.ReadFile(ivfile)
if err != nil {
Warn.Printf("readDirIV: %v\n", err)
return nil, err
}
if len(iv) != DIRIV_LEN {
return nil, fmt.Errorf("readDirIV: Invalid length %d\n", len(iv))
}
return iv, nil
}
// WriteDirIV - create diriv file inside "dir" (absolute path)

View File

@ -33,11 +33,11 @@ func TestExampleFsNormal(t *testing.T) {
t.Fatal(err)
}
mount(cDir, pDir, "-extpass", "echo test")
checkStatusTxt(t, pDir + "status.txt")
checkStatusTxt(t, pDir+"status.txt")
unmount(pDir)
mount(cDir, pDir, "-masterkey", "74676e34-0b47c145-00dac61a-17a92316-"+
"bb57044c-e205b71f-65f4fdca-7cabd4b3")
checkStatusTxt(t, pDir + "status.txt")
checkStatusTxt(t, pDir+"status.txt")
unmount(pDir)
err = os.Remove(pDir)
if err != nil {

View File

@ -39,7 +39,7 @@ func resetTmpDir() {
os.Exit(1)
}
dirIV := make([]byte, 16)
err = ioutil.WriteFile(defaultCipherDir + "gocryptfs.diriv", dirIV, 0444)
err = ioutil.WriteFile(defaultCipherDir+"gocryptfs.diriv", dirIV, 0444)
if err != nil {
fmt.Println(err)
os.Exit(1)

View File

@ -3,7 +3,6 @@ package integration_tests
// File reading, writing, modification, truncate
import (
"syscall"
"bytes"
"crypto/md5"
"encoding/hex"
@ -13,6 +12,7 @@ import (
"os"
"runtime"
"sync"
"syscall"
"testing"
)

View File

@ -1,9 +1,9 @@
package main
import (
"io/ioutil"
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
"os/signal"

View File

@ -3,10 +3,10 @@ package pathfs_frontend
import (
"encoding/base64"
"fmt"
"sync"
"syscall"
"os"
"path/filepath"
"sync"
"syscall"
"time"
"github.com/hanwen/go-fuse/fuse"
@ -17,13 +17,12 @@ import (
type FS struct {
*cryptfs.CryptFS
pathfs.FileSystem // loopbackFileSystem, see go-fuse/fuse/pathfs/loopback.go
backingDir string // Backing directory, cipherdir
pathfs.FileSystem // loopbackFileSystem, see go-fuse/fuse/pathfs/loopback.go
backingDir string // Backing directory, cipherdir
// dirIVLock: Lock()ed if any "gocryptfs.diriv" file is modified
// Readers must RLock() it to prevent them from seeing intermediate
// states
dirIVLock sync.RWMutex
}
// Encrypted FUSE overlay filesystem
@ -31,7 +30,7 @@ func NewFS(key []byte, backing string, useOpenssl bool, plaintextNames bool) *FS
return &FS{
CryptFS: cryptfs.NewCryptFS(key, useOpenssl, plaintextNames),
FileSystem: pathfs.NewLoopbackFileSystem(backing),
backingDir: backing,
backingDir: backing,
}
}