summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-08-18 15:47:17 +0200
committerJakob Unterwurzacher2021-08-18 15:48:01 +0200
commit64793fedf4ac8eebe05c57af75877944c60f03a4 (patch)
tree02f3d4840dabd2c1e49e3356293507edd898aa83 /tests
parentdc52e3215147e3f805be64705ee9e07a2cc453ee (diff)
Fix issues found by ineffassign
gocryptfs$ ineffassign ./... /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/configfile/config_file.go:243:2: ineffectual assignment to scryptHash /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/configfile/config_file.go:272:2: ineffectual assignment to scryptHash /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/fusefrontend/file.go:285:3: ineffectual assignment to fileID /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/fusefrontend/node.go:367:3: ineffectual assignment to err /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/fusefrontend/node_open_create.go:68:2: ineffectual assignment to fd /home/jakob/go/src/github.com/rfjakob/gocryptfs/mount.go:308:2: ineffectual assignment to masterkey /home/jakob/go/src/github.com/rfjakob/gocryptfs/gocryptfs-xray/xray_main.go:156:13: ineffectual assignment to err /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/fusefrontend/prepare_syscall_test.go:65:16: ineffectual assignment to errno /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/syscallcompat/open_nofollow_test.go:34:2: ineffectual assignment to fd /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/acl_test.go:111:6: ineffectual assignment to err /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/acl_test.go:181:2: ineffectual assignment to sz /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/acl_test.go:198:2: ineffectual assignment to sz /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/main_test.go:365:8: ineffectual assignment to err /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/xattr/xattr_fd_test.go:30:6: ineffectual assignment to err /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/xattr/xattr_fd_test.go:66:6: ineffectual assignment to err
Diffstat (limited to 'tests')
-rw-r--r--tests/defaults/acl_test.go7
-rw-r--r--tests/defaults/main_test.go3
-rw-r--r--tests/xattr/xattr_fd_test.go8
3 files changed, 14 insertions, 4 deletions
diff --git a/tests/defaults/acl_test.go b/tests/defaults/acl_test.go
index b3826e8..f3c707e 100644
--- a/tests/defaults/acl_test.go
+++ b/tests/defaults/acl_test.go
@@ -109,6 +109,9 @@ func TestAcl543(t *testing.T) {
t.Fatal(err)
}
fi, err := os.Stat(fn1)
+ if err != nil {
+ t.Fatal(err)
+ }
if fi.Mode() != modeWant {
t.Fatalf("mode changed from %o to %o", modeWant, fi.Mode())
}
@@ -178,7 +181,7 @@ func TestXattrOverflow(t *testing.T) {
if sz != len(val) {
t.Errorf("wrong sz: want %d have %d", len(val), sz)
}
- sz, err = unix.Lgetxattr(fn, attr, make([]byte, 1))
+ _, err = unix.Lgetxattr(fn, attr, make([]byte, 1))
if err != syscall.ERANGE {
t.Error(err)
}
@@ -195,7 +198,7 @@ func TestXattrOverflow(t *testing.T) {
if sz != szWant {
t.Errorf("wrong sz: want %d have %d", szWant, sz)
}
- sz, err = unix.Llistxattr(fn, make([]byte, 1))
+ _, err = unix.Llistxattr(fn, make([]byte, 1))
if err != syscall.ERANGE {
t.Error(err)
}
diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go
index 2513860..ddaca68 100644
--- a/tests/defaults/main_test.go
+++ b/tests/defaults/main_test.go
@@ -363,6 +363,9 @@ func TestMd5sumMaintainers(t *testing.T) {
cmd := exec.Command("md5sum", fn, fn, fn, fn)
out2, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Fatal(err)
+ }
out := string(out2)
// 195191 zero bytes have this md5sum
diff --git a/tests/xattr/xattr_fd_test.go b/tests/xattr/xattr_fd_test.go
index d3f02c5..7415e54 100644
--- a/tests/xattr/xattr_fd_test.go
+++ b/tests/xattr/xattr_fd_test.go
@@ -28,7 +28,9 @@ func TestFdXattr(t *testing.T) {
defer syscall.Close(fd)
buf := make([]byte, 1000)
sz, err := unix.Flistxattr(fd, buf)
- if sz != 0 {
+ if err != nil {
+ t.Error(err)
+ } else if sz != 0 {
t.Errorf("expected zero size, got %d", sz)
}
val1 := []byte("123456789")
@@ -64,7 +66,9 @@ func TestFdXattr(t *testing.T) {
t.Error(err)
}
sz, err = unix.Flistxattr(fd, buf)
- if sz != 0 {
+ if err != nil {
+ t.Error(err)
+ } else if sz != 0 {
t.Errorf("expected zero size, got %d", sz)
}
}