Remove pkg/minions and IsNil
Replaced with IsNil fn from modern-go/reflect2
This commit is contained in:
@@ -5,8 +5,8 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/cortezaproject/corteza-server/compose/types"
|
||||
"github.com/cortezaproject/corteza-server/pkg/minions"
|
||||
systemTypes "github.com/cortezaproject/corteza-server/system/types"
|
||||
"github.com/modern-go/reflect2"
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
@@ -238,7 +238,7 @@ func (r *ComposeModuleField) Resource() interface{} {
|
||||
// ComposeModuleFieldExtractUserFieldRoles is a helper to extract roles
|
||||
// from the given filer options.
|
||||
func ComposeModuleFieldExtractUserFieldRoles(i interface{}) []string {
|
||||
if minions.IsNil(i) {
|
||||
if reflect2.IsNil(i) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package minions
|
||||
|
||||
import "reflect"
|
||||
|
||||
// IsNil checks if the given interface is truly nil
|
||||
//
|
||||
// Due to how interfaces are handled under-the-hood, a simple i == nil may
|
||||
// not always be ok.
|
||||
func IsNil(i interface{}) bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
switch reflect.TypeOf(i).Kind() {
|
||||
case reflect.Ptr, reflect.Map, reflect.Array, reflect.Chan, reflect.Slice:
|
||||
return reflect.ValueOf(i).IsNil()
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
"github.com/cortezaproject/corteza-server/pkg/expr"
|
||||
"github.com/cortezaproject/corteza-server/pkg/filter"
|
||||
"github.com/cortezaproject/corteza-server/pkg/label"
|
||||
"github.com/cortezaproject/corteza-server/pkg/minions"
|
||||
rep "github.com/cortezaproject/corteza-server/pkg/report"
|
||||
"github.com/cortezaproject/corteza-server/store"
|
||||
"github.com/cortezaproject/corteza-server/system/types"
|
||||
"github.com/modern-go/reflect2"
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
@@ -475,7 +475,7 @@ func (svc *report) enhance(ctx context.Context, ff []*rep.Frame) (_ []*rep.Frame
|
||||
for _, r := range f.Rows {
|
||||
for _, ci := range userCols {
|
||||
col := r[ci]
|
||||
if minions.IsNil(col) {
|
||||
if reflect2.IsNil(col) {
|
||||
continue
|
||||
}
|
||||
switch col.Type() {
|
||||
|
||||
Reference in New Issue
Block a user