diff --git a/.gitignore b/.gitignore index daf913b..2ff911d 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ _testmain.go *.exe *.test *.prof + +download/win64/gochart/ diff --git a/chart_parser.go b/chart_parser.go index 449ae01..92fe515 100644 --- a/chart_parser.go +++ b/chart_parser.go @@ -1,6 +1,7 @@ package main import ( + "errors" "github.com/zieckey/goini" "os" "path/filepath" @@ -54,5 +55,9 @@ func LookupChartFiles(dir string) ([]string, error) { return nil }) + if len(files) == 0 { + return files, errors.New("Not found any *.chart files") + } + return files, err } diff --git a/server.go b/server.go index f9ea4f6..24ce3f6 100644 --- a/server.go +++ b/server.go @@ -1,7 +1,6 @@ package main import ( - "errors" //"fmt" "net/http" "text/template" @@ -19,7 +18,7 @@ func handler(w http.ResponseWriter, r *http.Request) { w.Write([]byte(err.Error())) return } - + Index++ Index = Index % len(ChartFiles) @@ -41,10 +40,8 @@ func ListenAndServe(addr string) error { if err != nil { return err } - if len(ChartFiles) == 0 { - return errors.New("No chart data.") - } + // Register chart handlders ChartHandlers["spline"] = new(SplineChart) ChartHandlers["column"] = new(SplineChart) ChartHandlers["area"] = new(SplineChart) diff --git a/template_pie_html.go b/template_pie_html.go index 2d1ad6b..e179b39 100644 --- a/template_pie_html.go +++ b/template_pie_html.go @@ -7,7 +7,7 @@ var TemplatePieHtml = `{{define "T"}}
-