diff options
author | Jakob Unterwurzacher | 2021-08-19 07:51:47 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2021-08-19 08:34:44 +0200 |
commit | c86981342b46875525f2b214687553e23e58eb1a (patch) | |
tree | 1d9a25bdbc5d64c9e7f74d99b93c56eb5b13e9ac /tests | |
parent | 2a25c3a8fda1f0918fd76687561b1a9c615298b9 (diff) |
golangci-lint: fix issues found by gosimple
Everything except the
if err2.Err == syscall.EOPNOTSUPP
case. Gets too confusing when collapsed into a single line.
Issues were:
$ golangci-lint run --disable-all --enable gosimple
mount.go:473:2: S1008: should use 'return strings.HasPrefix(v, "fusermount version")' instead of 'if strings.HasPrefix(v, "fusermount version") { return true }; return false' (gosimple)
if strings.HasPrefix(v, "fusermount version") {
^
cli_args.go:258:5: S1002: should omit comparison to bool constant, can be simplified to `args.forcedecode` (gosimple)
if args.forcedecode == true {
^
cli_args.go:263:6: S1002: should omit comparison to bool constant, can be simplified to `args.aessiv` (gosimple)
if args.aessiv == true {
^
cli_args.go:267:6: S1002: should omit comparison to bool constant, can be simplified to `args.reverse` (gosimple)
if args.reverse == true {
^
internal/stupidgcm/stupidgcm.go:227:6: S1002: should omit comparison to bool constant, can be simplified to `g.forceDecode` (gosimple)
if g.forceDecode == true {
^
gocryptfs-xray/xray_tests/xray_test.go:23:5: S1004: should use !bytes.Equal(out, expected) instead (gosimple)
if bytes.Compare(out, expected) != 0 {
^
gocryptfs-xray/xray_tests/xray_test.go:40:5: S1004: should use !bytes.Equal(out, expected) instead (gosimple)
if bytes.Compare(out, expected) != 0 {
^
gocryptfs-xray/paths_ctlsock.go:34:20: S1002: should omit comparison to bool constant, can be simplified to `!eof` (gosimple)
for eof := false; eof == false; line++ {
^
tests/reverse/xattr_test.go:19:2: S1008: should use 'return err2.Err != syscall.EOPNOTSUPP' instead of 'if err2.Err == syscall.EOPNOTSUPP { return false }; return true' (gosimple)
if err2.Err == syscall.EOPNOTSUPP {
^
internal/fusefrontend/node.go:459:45: S1002: should omit comparison to bool constant, can be simplified to `!nameFileAlreadyThere` (gosimple)
if nametransform.IsLongContent(cName2) && nameFileAlreadyThere == false {
^
tests/xattr/xattr_integration_test.go:221:2: S1008: should use 'return err2.Err != syscall.EOPNOTSUPP' instead of 'if err2.Err == syscall.EOPNOTSUPP { return false }; return true' (gosimple)
if err2.Err == syscall.EOPNOTSUPP {
^
tests/test_helpers/helpers.go:338:19: S1002: should omit comparison to bool constant, can be simplified to `open` (gosimple)
if err != nil && open == true {
^
tests/matrix/concurrency_test.go:121:7: S1004: should use !bytes.Equal(buf, content) instead (gosimple)
if bytes.Compare(buf, content) != 0 {
^
Diffstat (limited to 'tests')
-rw-r--r-- | tests/matrix/concurrency_test.go | 2 | ||||
-rw-r--r-- | tests/test_helpers/helpers.go | 2 |
2 files changed, 2 insertions, 2 deletions
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() |