Fix a bug : trim spaces of the data

This commit is contained in:
weizili.build9 2017-03-10 19:27:36 +08:00
parent 35014aec6e
commit 7ac81fe784
3 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/zieckey/goini"
"os"
"path/filepath"
"log"
)
const DataPrefix = "Data|"
@ -50,6 +51,7 @@ func LookupChartFiles(dir string) ([]string, error) {
if ok, err := filepath.Match("*.chart", f.Name()); err != nil {
return err
} else if ok {
log.Printf("Add chart file %v", path)
files = append(files, path)
}
return nil

View File

@ -26,9 +26,10 @@ func (c *SplineChart) Parse(ini *goini.INI) (map[string]string, error) {
continue
}
dd := strings.Split(v, ", ")
dd := strings.Split(v, ",")
jd := make([]interface{}, 0)
for _, d := range dd {
d = strings.TrimSpace(d)
val, err := strconv.ParseFloat(d, 64)
if err == nil {
jd = append(jd, val)

4
glide.yaml Normal file
View File

@ -0,0 +1,4 @@
package: github.com/zieckey/gochart
import:
- package: github.com/bitly/go-simplejson
- package: github.com/zieckey/goini