[lxc-devel] [go-lxc/v2] Use the boolean results directly

caglar10ur on Github lxc-bot at linuxcontainers.org
Sat Sep 16 22:24:28 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 302 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170916/aeb59e7b/attachment.bin>
-------------- next part --------------
From a79d6bfc7b296b918bf646997aa14012bf661a30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= <caglar at 10ur.org>
Date: Sat, 16 Sep 2017 15:23:48 -0700
Subject: [PATCH] Use the boolean results directly

---
 lxc_test.go | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/lxc_test.go b/lxc_test.go
index 3cd8f9b..c0517b8 100644
--- a/lxc_test.go
+++ b/lxc_test.go
@@ -37,10 +37,7 @@ func PathExists(name string) bool {
 }
 
 func unprivileged() bool {
-	if os.Geteuid() != 0 {
-		return true
-	}
-	return false
+	return os.Geteuid() != 0
 }
 
 func supported(moduleName string) bool {
@@ -1011,7 +1008,7 @@ func TestRunCommand(t *testing.T) {
 	if err != nil {
 		t.Errorf(err.Error())
 	}
-	if ok != true {
+	if !ok {
 		t.Errorf("Expected success")
 	}
 
@@ -1020,7 +1017,7 @@ func TestRunCommand(t *testing.T) {
 	if err != nil {
 		t.Errorf(err.Error())
 	}
-	if ok != false {
+	if ok {
 		t.Errorf("Expected failure")
 	}
 }
@@ -1040,7 +1037,7 @@ func TestCommandWithEnv(t *testing.T) {
 	if err != nil {
 		t.Errorf(err.Error())
 	}
-	if ok != true {
+	if !ok {
 		t.Errorf("Expected success")
 	}
 }
@@ -1060,7 +1057,7 @@ func TestCommandWithEnvToKeep(t *testing.T) {
 	if err != nil {
 		t.Errorf(err.Error())
 	}
-	if ok != true {
+	if !ok {
 		t.Errorf("Expected success")
 	}
 }
@@ -1079,7 +1076,7 @@ func TestCommandWithCwd(t *testing.T) {
 	if err != nil {
 		t.Errorf(err.Error())
 	}
-	if ok != true {
+	if !ok {
 		t.Errorf("Expected success")
 	}
 }
@@ -1099,7 +1096,7 @@ func TestCommandWithUIDGID(t *testing.T) {
 	if err != nil {
 		t.Errorf(err.Error())
 	}
-	if ok != true {
+	if !ok {
 		t.Errorf("Expected success")
 	}
 }
@@ -1135,7 +1132,7 @@ func TestCommandWithArch(t *testing.T) {
 	if err != nil {
 		t.Errorf(err.Error())
 	}
-	if ok != true {
+	if !ok {
 		t.Errorf("Expected success")
 	}
 }


More information about the lxc-devel mailing list