diff --git a/lgensemble_io.go b/lgensemble_io.go index 049e6ff..6721278 100644 --- a/lgensemble_io.go +++ b/lgensemble_io.go @@ -221,11 +221,11 @@ func LGEnsembleFromReader(reader *bufio.Reader) (*LGEnsemble, error) { if err := mapValueCompare(params, "num_tree_per_iteration", "1"); err != nil { return nil, err } - if maxFeatureIdx, err := mapValueToInt(params, "max_feature_idx"); err != nil { + maxFeatureIdx, err := mapValueToInt(params, "max_feature_idx") + if err != nil { return nil, err - } else { - e.MaxFeatureIdx = uint32(maxFeatureIdx) } + e.MaxFeatureIdx = uint32(maxFeatureIdx) treeSizesStr, isFound := params["tree_sizes"] if !isFound { diff --git a/mat_io.go b/mat_io.go index 262461a..9dc901c 100644 --- a/mat_io.go +++ b/mat_io.go @@ -31,7 +31,7 @@ func DenseMatFromLibsvm(reader *bufio.Reader, limit uint32, skipFirstColumn bool return mat, fmt.Errorf("too few columns") } - column := uint32(0) + var column uint32 for col := startIndex; col < uint32(len(tokens)); col++ { if len(tokens[col]) == 0 { break @@ -93,7 +93,7 @@ func CSRMatFromLibsvm(reader *bufio.Reader, limit uint32, skipFirstColumn bool) } mat.RowHeaders = append(mat.RowHeaders, uint32(len(mat.Values))) - column := uint32(0) + var column uint32 for col := startIndex; col < uint32(len(tokens)); col++ { if len(tokens[col]) == 0 { break @@ -150,7 +150,7 @@ func DenseMatFromCsv(reader *bufio.Reader, } tokens := strings.Split(line, delimiter) - column := uint32(0) + var column uint32 for col := startIndex; col < uint32(len(tokens)); col++ { var value float64 if len(tokens[col]) == 0 {