style fix for error checking (#1170)

+additional linting
This commit is contained in:
Meisam
2021-07-09 20:16:44 +02:00
committed by GitHub
parent a13e1e75e2
commit 7361578412
22 changed files with 62 additions and 112 deletions

View File

@@ -5,8 +5,7 @@ import (
)
func TestCreateAccessToken(t *testing.T) {
_, err := GenerateAccessToken()
if err != nil {
if _, err := GenerateAccessToken(); err != nil {
t.Error(err)
}
}

View File

@@ -49,8 +49,7 @@ func Restore(backupFile string, databaseFile string) error {
if err != nil {
return err
}
_, err = db.Exec(rawSql)
if err != nil {
if _, err := db.Exec(rawSql); err != nil {
return err
}

View File

@@ -161,8 +161,7 @@ func GetCacheDurationSecondsForPath(filePath string) int {
}
func IsValidUrl(urlToTest string) bool {
_, err := url.ParseRequestURI(urlToTest)
if err != nil {
if _, err := url.ParseRequestURI(urlToTest); err != nil {
return false
}
@@ -236,4 +235,4 @@ func CleanupDirectory(path string) {
if err := os.MkdirAll(path, 0777); err != nil {
log.Fatalln("Unable to create directory. Please check the ownership and permissions", err)
}
}
}