make cover.sh compatible with Goobuntu, improve style
diff --git a/api.go b/api.go index 63a9a29..9a09920 100644 --- a/api.go +++ b/api.go
@@ -107,16 +107,18 @@ // DANGER: This relies on an external TABLE - EDGEX_DATA_SCOPE is maintained by apidApigeeSync var env, tenantId string - error := db.QueryRow("SELECT env, scope FROM EDGEX_DATA_SCOPE WHERE id = ?;", scopeuuid).Scan(&env, &tenantId) + err := db.QueryRow("SELECT env, scope FROM EDGEX_DATA_SCOPE WHERE id = ?;", scopeuuid).Scan(&env, &tenantId) - switch { - case error == sql.ErrNoRows: + switch err { + case sql.ErrNoRows: log.Error("verifyAPIKey: sql.ErrNoRows") reason := "ENV Validation Failed" errorCode := "ENV_VALIDATION_FAILED" return errorResponse(reason, errorCode) - case error != nil: - reason := error.Error() + case nil: + + default: + reason := err.Error() errorCode := "SEARCH_INTERNAL_ERROR" return errorResponse(reason, errorCode) } @@ -182,7 +184,7 @@ sqlite snapshots, we are not necessarily guaranteed that */ var status, redirectionURIs, appName, appId, resName, resEnv, issuedAt, cType sql.NullString - err := db.QueryRow(sSql, key, tenantId).Scan(&resName, &resEnv, &issuedAt, &status, + err = db.QueryRow(sSql, key, tenantId).Scan(&resName, &resEnv, &issuedAt, &status, &redirectionURIs, &appName, &appId, &cType) switch { case err == sql.ErrNoRows:
diff --git a/cover.sh b/cover.sh index 422ebb3..5817065 100755 --- a/cover.sh +++ b/cover.sh
@@ -22,7 +22,7 @@ for d in $(go list ./... | grep -v vendor); do go test -coverprofile=profile.out -covermode=atomic $d if [ -f profile.out ]; then - tail +2 profile.out >> coverage.txt + tail -n +2 profile.out >> coverage.txt rm profile.out fi done