pgterminate/base/utils.go

23 lines
383 B
Go
Raw Normal View History

2018-06-10 08:44:53 +02:00
package base
import (
2018-06-24 17:49:48 +02:00
"github.com/jouir/pgterminate/log"
2018-06-10 08:44:53 +02:00
)
// Panic prints a non-nil error and terminates the program
func Panic(err error) {
if err != nil {
2018-06-24 17:49:48 +02:00
log.Fatalf("%s\n", err)
2018-06-10 08:44:53 +02:00
}
}
2018-06-30 10:44:58 +02:00
// InSlice detects value presence in a string slice
func InSlice(value string, slice []string) bool {
for _, val := range slice {
if value == val {
return true
}
}
return false
}