From 742dd407b48ad19782ac74ac7f672cb125d44e6f Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Sun, 3 Apr 2022 22:34:48 -0400 Subject: [PATCH 1/4] main: len() works on nil now Signed-off-by: Vincent Batts --- cmd/gomtree/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/gomtree/main.go b/cmd/gomtree/main.go index 42bc286..6e8a058 100644 --- a/cmd/gomtree/main.go +++ b/cmd/gomtree/main.go @@ -258,7 +258,7 @@ func app() error { if err != nil { return err } - if result != nil && len(result) > 0 { + if len(result) > 0 { fmt.Printf("%#v\n", result) } From 6fb913af9998403d964249817ee66cf41f685485 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Sun, 3 Apr 2022 22:41:54 -0400 Subject: [PATCH 2/4] compare_test: remove unused code Signed-off-by: Vincent Batts --- compare_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/compare_test.go b/compare_test.go index 8953c1e..5a13961 100644 --- a/compare_test.go +++ b/compare_test.go @@ -90,8 +90,6 @@ func TestCompareModified(t *testing.T) { } // These cannot fail. - tmpfile, _ = filepath.Rel(dir, tmpfile) - tmpdir, _ = filepath.Rel(dir, tmpdir) tmpsubfile, _ = filepath.Rel(dir, tmpsubfile) for _, diff := range diffs { From a867d302518d74f633e41afb996dcd6ce20903a6 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Sun, 3 Apr 2022 22:42:16 -0400 Subject: [PATCH 3/4] check_test: check the error Signed-off-by: Vincent Batts --- check_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/check_test.go b/check_test.go index 1b10d9e..594fa63 100644 --- a/check_test.go +++ b/check_test.go @@ -273,6 +273,9 @@ func TestIgnoreComments(t *testing.T) { .. ` dh, err = ParseSpec(bytes.NewBufferString(spec)) + if err != nil { + t.Error(err) + } res, err = Check(dir, dh, nil, nil) if err != nil { From f7c1f627aa31f0997e25f7e00d09074dc4aeedfc Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Sun, 3 Apr 2022 22:44:14 -0400 Subject: [PATCH 4/4] keyword_test: remove unused line Signed-off-by: Vincent Batts --- keywords_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/keywords_test.go b/keywords_test.go index 3dac002..a1e7890 100644 --- a/keywords_test.go +++ b/keywords_test.go @@ -39,7 +39,6 @@ func TestKeyValRoundtrip(t *testing.T) { t.Errorf("expected %q; got %q", expected, got) } - expected = "xattr.security.selinux=farts" kv1 := KeyVal(got) kv2 := kv.NewValue("farts") if !kv2.Equal(kv1) {