Run go fmt
This commit is contained in:
parent
6acd772cf9
commit
a04a92cdab
|
@ -9,16 +9,16 @@ import (
|
||||||
|
|
||||||
// readDirIV - read the "gocryptfs.diriv" file from "dir" (absolute path)
|
// readDirIV - read the "gocryptfs.diriv" file from "dir" (absolute path)
|
||||||
func (be *CryptFS) readDirIV(dir string) (iv []byte, err error) {
|
func (be *CryptFS) readDirIV(dir string) (iv []byte, err error) {
|
||||||
ivfile := filepath.Join(dir, DIRIV_FILENAME)
|
ivfile := filepath.Join(dir, DIRIV_FILENAME)
|
||||||
iv, err = ioutil.ReadFile(ivfile)
|
iv, err = ioutil.ReadFile(ivfile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Warn.Printf("readDirIV: %v\n", err)
|
Warn.Printf("readDirIV: %v\n", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(iv) != DIRIV_LEN {
|
if len(iv) != DIRIV_LEN {
|
||||||
return nil, fmt.Errorf("readDirIV: Invalid length %d\n", len(iv))
|
return nil, fmt.Errorf("readDirIV: Invalid length %d\n", len(iv))
|
||||||
}
|
}
|
||||||
return iv, nil
|
return iv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteDirIV - create diriv file inside "dir" (absolute path)
|
// WriteDirIV - create diriv file inside "dir" (absolute path)
|
||||||
|
|
|
@ -33,11 +33,11 @@ func TestExampleFsNormal(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
mount(cDir, pDir, "-extpass", "echo test")
|
mount(cDir, pDir, "-extpass", "echo test")
|
||||||
checkStatusTxt(t, pDir + "status.txt")
|
checkStatusTxt(t, pDir+"status.txt")
|
||||||
unmount(pDir)
|
unmount(pDir)
|
||||||
mount(cDir, pDir, "-masterkey", "74676e34-0b47c145-00dac61a-17a92316-"+
|
mount(cDir, pDir, "-masterkey", "74676e34-0b47c145-00dac61a-17a92316-"+
|
||||||
"bb57044c-e205b71f-65f4fdca-7cabd4b3")
|
"bb57044c-e205b71f-65f4fdca-7cabd4b3")
|
||||||
checkStatusTxt(t, pDir + "status.txt")
|
checkStatusTxt(t, pDir+"status.txt")
|
||||||
unmount(pDir)
|
unmount(pDir)
|
||||||
err = os.Remove(pDir)
|
err = os.Remove(pDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -39,7 +39,7 @@ func resetTmpDir() {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
dirIV := make([]byte, 16)
|
dirIV := make([]byte, 16)
|
||||||
err = ioutil.WriteFile(defaultCipherDir + "gocryptfs.diriv", dirIV, 0444)
|
err = ioutil.WriteFile(defaultCipherDir+"gocryptfs.diriv", dirIV, 0444)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
|
@ -3,7 +3,6 @@ package integration_tests
|
||||||
// File reading, writing, modification, truncate
|
// File reading, writing, modification, truncate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
@ -13,6 +12,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
2
main.go
2
main.go
|
@ -1,9 +1,9 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
|
|
@ -3,10 +3,10 @@ package pathfs_frontend
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
|
||||||
"syscall"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sync"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hanwen/go-fuse/fuse"
|
"github.com/hanwen/go-fuse/fuse"
|
||||||
|
@ -17,13 +17,12 @@ import (
|
||||||
|
|
||||||
type FS struct {
|
type FS struct {
|
||||||
*cryptfs.CryptFS
|
*cryptfs.CryptFS
|
||||||
pathfs.FileSystem // loopbackFileSystem, see go-fuse/fuse/pathfs/loopback.go
|
pathfs.FileSystem // loopbackFileSystem, see go-fuse/fuse/pathfs/loopback.go
|
||||||
backingDir string // Backing directory, cipherdir
|
backingDir string // Backing directory, cipherdir
|
||||||
// dirIVLock: Lock()ed if any "gocryptfs.diriv" file is modified
|
// dirIVLock: Lock()ed if any "gocryptfs.diriv" file is modified
|
||||||
// Readers must RLock() it to prevent them from seeing intermediate
|
// Readers must RLock() it to prevent them from seeing intermediate
|
||||||
// states
|
// states
|
||||||
dirIVLock sync.RWMutex
|
dirIVLock sync.RWMutex
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encrypted FUSE overlay filesystem
|
// Encrypted FUSE overlay filesystem
|
||||||
|
@ -31,7 +30,7 @@ func NewFS(key []byte, backing string, useOpenssl bool, plaintextNames bool) *FS
|
||||||
return &FS{
|
return &FS{
|
||||||
CryptFS: cryptfs.NewCryptFS(key, useOpenssl, plaintextNames),
|
CryptFS: cryptfs.NewCryptFS(key, useOpenssl, plaintextNames),
|
||||||
FileSystem: pathfs.NewLoopbackFileSystem(backing),
|
FileSystem: pathfs.NewLoopbackFileSystem(backing),
|
||||||
backingDir: backing,
|
backingDir: backing,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue