From a04a92cdab11df43f072db685b8ade6c973f8995 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Fri, 27 Nov 2015 22:20:01 +0100 Subject: [PATCH] Run go fmt --- cryptfs/names_diriv.go | 20 +++++++++---------- integration_tests/example_filesystems_test.go | 4 ++-- integration_tests/helpers.go | 2 +- integration_tests/main_test.go | 2 +- main.go | 2 +- pathfs_frontend/fs.go | 11 +++++----- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/cryptfs/names_diriv.go b/cryptfs/names_diriv.go index 46e2bfd..ab039f0 100644 --- a/cryptfs/names_diriv.go +++ b/cryptfs/names_diriv.go @@ -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) diff --git a/integration_tests/example_filesystems_test.go b/integration_tests/example_filesystems_test.go index be9ef67..644f8e7 100644 --- a/integration_tests/example_filesystems_test.go +++ b/integration_tests/example_filesystems_test.go @@ -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 { diff --git a/integration_tests/helpers.go b/integration_tests/helpers.go index 3d6811f..6fc65cf 100644 --- a/integration_tests/helpers.go +++ b/integration_tests/helpers.go @@ -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) diff --git a/integration_tests/main_test.go b/integration_tests/main_test.go index e46e2e4..f065c4a 100644 --- a/integration_tests/main_test.go +++ b/integration_tests/main_test.go @@ -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" ) diff --git a/main.go b/main.go index 50225c5..87ae67a 100644 --- a/main.go +++ b/main.go @@ -1,9 +1,9 @@ package main import ( - "io/ioutil" "flag" "fmt" + "io/ioutil" "os" "os/exec" "os/signal" diff --git a/pathfs_frontend/fs.go b/pathfs_frontend/fs.go index 0e0d022..680b08c 100644 --- a/pathfs_frontend/fs.go +++ b/pathfs_frontend/fs.go @@ -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, } }