Browse Source

test: add naked return checks

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
Gyu-Ho Lee 8 years ago
parent
commit
65a606e2e8
1 changed files with 11 additions and 0 deletions
  1. 11 0
      test

+ 11 - 0
test

@@ -403,6 +403,17 @@ function fmt_pass {
 		echo "Skipping ineffassign..."
 		echo "Skipping ineffassign..."
 	fi
 	fi
 
 
+	if which nakedret >/dev/null; then
+		echo "Checking nakedret..."
+		nakedretResult=$(nakedret "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true)
+		if [ -n "${nakedretResult}" ]; then
+			echo -e "nakedret checking failed:\n${nakedretResult}"
+			exit 255
+		fi
+	else
+		echo "Skipping nakedret..."
+	fi
+
 	echo "Checking for license header..."
 	echo "Checking for license header..."
 	licRes=""
 	licRes=""
 	files=$(find . -type f -iname '*.go' ! -path './cmd/*' ! -path './gopath.proto/*')
 	files=$(find . -type f -iname '*.go' ! -path './cmd/*' ! -path './gopath.proto/*')