mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-04 15:10:54 +00:00
alert: Add optimizations (#939)
* alert: Add optimizations * alert: add basic benchmarks * alert: fix linter issue * documentation: change to text/template as html/template escapes to protect against code injection. Add readme.md for alert. * README: Add package name * alert: link up with engine settings * request: isVerbose refactor * Update exchanges/alert/alert_test.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update exchanges/alert/alert.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * glorious: nits * glorious: fun police * documentation: regen Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
@@ -6,12 +6,12 @@ import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/thrasher-corp/gocryptotrader/common"
|
||||
@@ -430,14 +430,16 @@ func GetTemplateFiles() (*template.Template, error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
var parseError error
|
||||
tmpl, parseError = tmpl.ParseGlob(filepath.Join(path, "*.tmpl"))
|
||||
if parseError != nil {
|
||||
if strings.Contains(parseError.Error(), "pattern matches no files") {
|
||||
var tmplExt *template.Template
|
||||
tmplExt, err = tmpl.ParseGlob(filepath.Join(path, "*.tmpl"))
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
if strings.Contains(err.Error(), "pattern matches no files") {
|
||||
return nil
|
||||
}
|
||||
return parseError
|
||||
return err
|
||||
}
|
||||
tmpl = tmplExt
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user