diff options
-rw-r--r-- | cli_args.go | 8 | ||||
-rw-r--r-- | gocryptfs-xray/paths_ctlsock.go | 2 | ||||
-rw-r--r-- | gocryptfs-xray/xray_tests/xray_test.go | 4 | ||||
-rw-r--r-- | internal/fusefrontend/node.go | 2 | ||||
-rw-r--r-- | internal/stupidgcm/stupidgcm.go | 2 | ||||
-rw-r--r-- | mount.go | 5 | ||||
-rw-r--r-- | tests/matrix/concurrency_test.go | 2 | ||||
-rw-r--r-- | tests/test_helpers/helpers.go | 2 |
8 files changed, 12 insertions, 15 deletions
diff --git a/cli_args.go b/cli_args.go index 1ece378..058f932 100644 --- a/cli_args.go +++ b/cli_args.go @@ -255,16 +255,16 @@ func parseCliOpts(osArgs []string) (args argContainer) { } } // "-forcedecode" only works with openssl. Check compilation and command line parameters - if args.forcedecode == true { - if stupidgcm.BuiltWithoutOpenssl == true { + if args.forcedecode { + if stupidgcm.BuiltWithoutOpenssl { tlog.Fatal.Printf("The -forcedecode flag requires openssl support, but gocryptfs was compiled without it!") os.Exit(exitcodes.Usage) } - if args.aessiv == true { + if args.aessiv { tlog.Fatal.Printf("The -forcedecode and -aessiv flags are incompatible because they use different crypto libs (openssl vs native Go)") os.Exit(exitcodes.Usage) } - if args.reverse == true { + if args.reverse { tlog.Fatal.Printf("The reverse mode and the -forcedecode option are not compatible") os.Exit(exitcodes.Usage) } diff --git a/gocryptfs-xray/paths_ctlsock.go b/gocryptfs-xray/paths_ctlsock.go index c489f0e..278916f 100644 --- a/gocryptfs-xray/paths_ctlsock.go +++ b/gocryptfs-xray/paths_ctlsock.go @@ -31,7 +31,7 @@ func transformPaths(socketPath string, req *ctlsock.RequestStruct, in *string, s separator = '\000' } r := bufio.NewReader(os.Stdin) - for eof := false; eof == false; line++ { + for eof := false; !eof; line++ { val, err := r.ReadBytes(separator) if len(val) == 0 { break diff --git a/gocryptfs-xray/xray_tests/xray_test.go b/gocryptfs-xray/xray_tests/xray_test.go index 790d2db..2df83f2 100644 --- a/gocryptfs-xray/xray_tests/xray_test.go +++ b/gocryptfs-xray/xray_tests/xray_test.go @@ -20,7 +20,7 @@ func TestAesgcmXray(t *testing.T) { if err != nil { t.Fatal(err) } - if bytes.Compare(out, expected) != 0 { + if !bytes.Equal(out, expected) { t.Errorf("Unexpected output") fmt.Printf("expected:\n%s", string(expected)) fmt.Printf("have:\n%s", string(out)) @@ -37,7 +37,7 @@ func TestAessivXray(t *testing.T) { if err != nil { t.Fatal(err) } - if bytes.Compare(out, expected) != 0 { + if !bytes.Equal(out, expected) { t.Errorf("Unexpected output") fmt.Printf("expected:\n%s", string(expected)) fmt.Printf("have:\n%s", string(out)) diff --git a/internal/fusefrontend/node.go b/internal/fusefrontend/node.go index 7280624..0f63fdf 100644 --- a/internal/fusefrontend/node.go +++ b/internal/fusefrontend/node.go @@ -456,7 +456,7 @@ func (n *Node) Rename(ctx context.Context, name string, newParent fs.InodeEmbedd } } if err != nil { - if nametransform.IsLongContent(cName2) && nameFileAlreadyThere == false { + if nametransform.IsLongContent(cName2) && !nameFileAlreadyThere { // Roll back .name creation unless the .name file was already there nametransform.DeleteLongNameAt(dirfd2, cName2) } diff --git a/internal/stupidgcm/stupidgcm.go b/internal/stupidgcm/stupidgcm.go index 82d0323..01db41b 100644 --- a/internal/stupidgcm/stupidgcm.go +++ b/internal/stupidgcm/stupidgcm.go @@ -224,7 +224,7 @@ func (g *StupidGCM) Open(dst, iv, in, authData []byte) ([]byte, error) { if res != 1 { // The error code must always be checked by the calling function, because the decrypted buffer // may contain corrupted data that we are returning in case the user forced reads - if g.forceDecode == true { + if g.forceDecode { return append(dst, buf...), ErrAuth } return nil, ErrAuth @@ -470,10 +470,7 @@ func haveFusermount2() bool { // libfuse 2: fusermount version: 2.9.9 // libfuse 3: fusermount3 version: 3.9.0 v := out.String() - if strings.HasPrefix(v, "fusermount version") { - return true - } - return false + return strings.HasPrefix(v, "fusermount version") } func handleSigint(srv *fuse.Server, mountpoint string) { diff --git a/tests/matrix/concurrency_test.go b/tests/matrix/concurrency_test.go index 6a9b9aa..1afd33d 100644 --- a/tests/matrix/concurrency_test.go +++ b/tests/matrix/concurrency_test.go @@ -118,7 +118,7 @@ func TestConcurrentReadCreate(t *testing.T) { log.Fatal(err) } buf := buf0[:n] - if bytes.Compare(buf, content) != 0 { + if !bytes.Equal(buf, content) { // Calling t.Fatal() from a goroutine hangs the test so we use log.Fatal log.Fatalf("%s: content mismatch: have=%q want=%q", t.Name(), string(buf), string(content)) } diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go index 5bc1298..2a0feb8 100644 --- a/tests/test_helpers/helpers.go +++ b/tests/test_helpers/helpers.go @@ -335,7 +335,7 @@ func VerifyExistence(t *testing.T, path string) bool { dir := filepath.Dir(path) name := filepath.Base(path) d, err := os.Open(dir) - if err != nil && open == true { + if err != nil && open { t.Errorf("VerifyExistence: we can open the file but not the parent dir!? err=%v", err) } else if err == nil { defer d.Close() |