aboutsummaryrefslogtreecommitdiff
path: root/lib/tabula
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2018-11-30 10:23:29 +0700
committerShulhan <ms@kilabit.info>2018-11-30 10:23:29 +0700
commit645c7bb752465782a4e46b703c5250d345b495bd (patch)
treee0099dbc8dce592b2e491c19c8ae41bfc68c6b68 /lib/tabula
parentb077d6796655e1be9864e0c64068bdcd5d1d2649 (diff)
downloadpakakeh.go-645c7bb752465782a4e46b703c5250d345b495bd.tar.xz
all: fix linter warnings on naked return
Diffstat (limited to 'lib/tabula')
-rw-r--r--lib/tabula/columns.go2
-rw-r--r--lib/tabula/datasetinterface.go28
-rw-r--r--lib/tabula/rows.go3
3 files changed, 16 insertions, 17 deletions
diff --git a/lib/tabula/columns.go b/lib/tabula/columns.go
index a5cd05d5..7a13f238 100644
--- a/lib/tabula/columns.go
+++ b/lib/tabula/columns.go
@@ -95,7 +95,7 @@ func (cols *Columns) RandomPick(n int, dup bool, excludeIdx []int) (
}
}
- return
+ return picked, unpicked, pickedIdx, unpickedIdx
}
//
diff --git a/lib/tabula/datasetinterface.go b/lib/tabula/datasetinterface.go
index 7ca16ae8..2ace851e 100644
--- a/lib/tabula/datasetinterface.go
+++ b/lib/tabula/datasetinterface.go
@@ -119,11 +119,11 @@ func SplitRowsByNumeric(di DatasetInterface, colidx int, splitVal float64) (
// check type of column
coltype, e := di.GetColumnTypeAt(colidx)
if e != nil {
- return
+ return nil, nil, e
}
if !(coltype == TInteger || coltype == TReal) {
- return splitLess, splitGreater, ErrInvalidColType
+ return nil, nil, ErrInvalidColType
}
// Should we convert the data mode back later.
@@ -163,7 +163,7 @@ func SplitRowsByNumeric(di DatasetInterface, colidx int, splitVal float64) (
// do nothing, since its already filled when pushing new row.
}
- return
+ return splitLess, splitGreater, nil
}
//
@@ -186,8 +186,7 @@ func SplitRowsByNumeric(di DatasetInterface, colidx int, splitVal float64) (
// X'': [B,B,D,D]
// Y'': [2,4,6,8]
//
-func SplitRowsByCategorical(di DatasetInterface, colidx int,
- splitVal []string) (
+func SplitRowsByCategorical(di DatasetInterface, colidx int, splitVal []string) (
splitIn DatasetInterface,
splitEx DatasetInterface,
e error,
@@ -195,11 +194,11 @@ func SplitRowsByCategorical(di DatasetInterface, colidx int,
// check type of column
coltype, e := di.GetColumnTypeAt(colidx)
if e != nil {
- return
+ return nil, nil, e
}
if coltype != TString {
- return splitIn, splitEx, ErrInvalidColType
+ return nil, nil, ErrInvalidColType
}
// should we convert the data mode back?
@@ -237,7 +236,7 @@ func SplitRowsByCategorical(di DatasetInterface, colidx int,
splitEx.TransposeToColumns()
}
- return
+ return splitIn, splitEx, nil
}
//
@@ -253,7 +252,7 @@ func SplitRowsByValue(di DatasetInterface, colidx int, value interface{}) (
) {
coltype, e := di.GetColumnTypeAt(colidx)
if e != nil {
- return
+ return nil, nil, e
}
if coltype == TString {
@@ -280,7 +279,7 @@ func SplitRowsByValue(di DatasetInterface, colidx int, value interface{}) (
return nil, nil, e
}
- return
+ return splitL, splitR, nil
}
//
@@ -354,7 +353,7 @@ func RandomPickRows(dataset DatasetInterface, n int, duplicate bool) (
unpicked.TransposeToColumns()
}
- return
+ return picked, unpicked, pickedIdx, unpickedIdx
}
//
@@ -365,8 +364,7 @@ func RandomPickRows(dataset DatasetInterface, n int, duplicate bool) (
//
// If dataset output mode is rows, it will transposed to columns.
//
-func RandomPickColumns(dataset DatasetInterface, n int, dup bool,
- excludeIdx []int) (
+func RandomPickColumns(dataset DatasetInterface, n int, dup bool, excludeIdx []int) (
picked DatasetInterface,
unpicked DatasetInterface,
pickedIdx []int,
@@ -398,7 +396,7 @@ func RandomPickColumns(dataset DatasetInterface, n int, dup bool,
unpicked.TransposeToRows()
}
- return
+ return picked, unpicked, pickedIdx, unpickedIdx
}
//
@@ -437,5 +435,5 @@ func SelectColumnsByIdx(dataset DatasetInterface, colsIdx []int) (
// do nothing
}
- return
+ return newset
}
diff --git a/lib/tabula/rows.go b/lib/tabula/rows.go
index ac81a3f9..d9637fbe 100644
--- a/lib/tabula/rows.go
+++ b/lib/tabula/rows.go
@@ -184,7 +184,8 @@ func (rows *Rows) RandomPick(n int, duplicate bool) (
unpickedIdx = append(unpickedIdx, rid)
}
}
- return
+
+ return picked, unpicked, pickedIdx, unpickedIdx
}
//