mirror of
https://github.com/adnanh/webhook.git
synced 2026-07-26 17:19:17 +08:00
Simplify boolean some comparisons
This commit is contained in:
+2
-2
@@ -687,7 +687,7 @@ func (r AndRule) Evaluate(headers, query, payload *map[string]interface{}, body
|
|||||||
}
|
}
|
||||||
|
|
||||||
res = res && rv
|
res = res && rv
|
||||||
if res == false {
|
if !res {
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -709,7 +709,7 @@ func (r OrRule) Evaluate(headers, query, payload *map[string]interface{}, body *
|
|||||||
}
|
}
|
||||||
|
|
||||||
res = res || rv
|
res = res || rv
|
||||||
if res == true {
|
if res {
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -120,7 +120,7 @@ func main() {
|
|||||||
|
|
||||||
newHooksFiles := hooksFiles[:0]
|
newHooksFiles := hooksFiles[:0]
|
||||||
for _, filePath := range hooksFiles {
|
for _, filePath := range hooksFiles {
|
||||||
if _, ok := loadedHooksFromFiles[filePath]; ok == true {
|
if _, ok := loadedHooksFromFiles[filePath]; ok {
|
||||||
newHooksFiles = append(newHooksFiles, filePath)
|
newHooksFiles = append(newHooksFiles, filePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -436,7 +436,7 @@ func reloadHooks(hooksFilePath string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchLoadedHook(hook.ID) != nil && !wasHookIDAlreadyLoaded) || seenHooksIds[hook.ID] == true {
|
if (matchLoadedHook(hook.ID) != nil && !wasHookIDAlreadyLoaded) || seenHooksIds[hook.ID] {
|
||||||
log.Printf("error: hook with the id %s has already been loaded!\nplease check your hooks file for duplicate hooks ids!", hook.ID)
|
log.Printf("error: hook with the id %s has already been loaded!\nplease check your hooks file for duplicate hooks ids!", hook.ID)
|
||||||
log.Println("reverting hooks back to the previous configuration")
|
log.Println("reverting hooks back to the previous configuration")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user