removing go-sdk stuff

This commit is contained in:
Will Charczuk 2019-04-24 12:58:05 -07:00
parent 0576aba75e
commit 07a9cdf513
2 changed files with 6 additions and 10 deletions

View file

@ -4,15 +4,13 @@ import (
"bufio"
"io"
"os"
"github.com/blend/go-sdk/exception"
)
// ReadLines reads a file and calls the handler for each line.
func ReadLines(filePath string, handler func(string) error) error {
f, err := os.Open(filePath)
if err != nil {
return exception.New(err)
return err
}
defer f.Close()
@ -21,7 +19,7 @@ func ReadLines(filePath string, handler func(string) error) error {
line := scanner.Text()
err = handler(line)
if err != nil {
return exception.New(err)
return err
}
}
return nil
@ -31,7 +29,7 @@ func ReadLines(filePath string, handler func(string) error) error {
func ReadChunks(filePath string, chunkSize int, handler func([]byte) error) error {
f, err := os.Open(filePath)
if err != nil {
return exception.New(err)
return err
}
defer f.Close()
@ -44,7 +42,7 @@ func ReadChunks(filePath string, chunkSize int, handler func([]byte) error) erro
readData := chunk[:readBytes]
err = handler(readData)
if err != nil {
return exception.New(err)
return err
}
}
return nil

View file

@ -4,8 +4,6 @@ import (
"strconv"
"strings"
"time"
"github.com/blend/go-sdk/exception"
)
// ParseFloats parses a list of floats.
@ -20,7 +18,7 @@ func ParseFloats(values ...string) ([]float64, error) {
continue
}
if parsedValue, err = strconv.ParseFloat(cleaned, 64); err != nil {
return nil, exception.New(err)
return nil, err
}
output = append(output, parsedValue)
}
@ -34,7 +32,7 @@ func ParseTimes(layout string, values ...string) ([]time.Time, error) {
var err error
for _, value := range values {
if parsedValue, err = time.Parse(layout, value); err != nil {
return nil, exception.New(err)
return nil, err
}
output = append(output, parsedValue)
}