Some linter errors.
This commit is contained in:
parent
53a76f31b4
commit
f8daa1d76e
4 changed files with 12 additions and 7 deletions
|
|
@ -113,6 +113,13 @@ func IsNil(v interface{}) bool {
|
|||
return v == nil || (reflect.ValueOf(v).Kind() == reflect.Ptr && reflect.ValueOf(v).IsNil())
|
||||
}
|
||||
|
||||
// MustBeTrue panics when condition is false
|
||||
func MustBeTrue(condition bool, errorStr string) {
|
||||
if !condition {
|
||||
panic(errorStr)
|
||||
}
|
||||
}
|
||||
|
||||
// MustBe panics with errorStr error, if v interface is not of reflect kind
|
||||
func MustBe(v interface{}, kind reflect.Kind, errorStr string) {
|
||||
if reflect.TypeOf(v).Kind() != kind {
|
||||
|
|
@ -165,6 +172,7 @@ func ErrorCatch(err *error) {
|
|||
}
|
||||
}
|
||||
|
||||
// StringSliceContains checks if slice of strings contains a string
|
||||
func StringSliceContains(strings []string, contains string) bool {
|
||||
for _, str := range strings {
|
||||
if str == contains {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ var COUNT = jet.COUNT
|
|||
// EVERY is aggregate function. Returns true if all input values are true, otherwise false
|
||||
var EVERY = jet.EVERY
|
||||
|
||||
// MAXf is aggregate function. Returns maximum value of expression across all input values
|
||||
// MAX is aggregate function. Returns maximum value of expression across all input values
|
||||
var MAX = jet.MAX
|
||||
|
||||
// MAXf is aggregate function. Returns maximum value of float expression across all input values
|
||||
|
|
|
|||
|
|
@ -212,9 +212,7 @@ func (s *scanContext) rowElem(index int) interface{} {
|
|||
|
||||
valuer, ok := s.row[index].(driver.Valuer)
|
||||
|
||||
if !ok {
|
||||
panic("jet: internal error, scan value doesn't implement driver.Valuer")
|
||||
}
|
||||
utils.MustBeTrue(ok, "jet: internal error, scan value doesn't implement driver.Valuer")
|
||||
|
||||
value, err := valuer.Value()
|
||||
|
||||
|
|
|
|||
|
|
@ -50,9 +50,8 @@ func getSliceElemPtrAt(slicePtrValue reflect.Value, index int) reflect.Value {
|
|||
}
|
||||
|
||||
func appendElemToSlice(slicePtrValue reflect.Value, objPtrValue reflect.Value) error {
|
||||
if slicePtrValue.IsNil() {
|
||||
panic("jet: internal, slice is nil")
|
||||
}
|
||||
utils.MustBeTrue(!slicePtrValue.IsNil(), "jet: internal, slice is nil")
|
||||
|
||||
sliceValue := slicePtrValue.Elem()
|
||||
sliceElemType := sliceValue.Type().Elem()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue