From 52083de720bdb828e71ff94b278fd1f7bc5f830a Mon Sep 17 00:00:00 2001 From: JessonChan Date: Fri, 15 Jan 2016 14:07:37 +0800 Subject: [PATCH] typo fixed seperator => separator --- admin.go | 4 ++-- config.go | 12 ++++++------ config/config.go | 28 ++++++++++++++-------------- config_test.go | 2 +- controller.go | 2 +- flash.go | 4 ++-- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/admin.go b/admin.go index 0b45cf8a..3effc582 100644 --- a/admin.go +++ b/admin.go @@ -120,7 +120,7 @@ func listConf(rw http.ResponseWriter, r *http.Request) { m["BConfig.WebConfig.AutoRender"] = BConfig.WebConfig.AutoRender m["BConfig.WebConfig.EnableDocs"] = BConfig.WebConfig.EnableDocs m["BConfig.WebConfig.FlashName"] = BConfig.WebConfig.FlashName - m["BConfig.WebConfig.FlashSeperator"] = BConfig.WebConfig.FlashSeperator + m["BConfig.WebConfig.FlashSeparator"] = BConfig.WebConfig.FlashSeparator m["BConfig.WebConfig.DirectoryIndex"] = BConfig.WebConfig.DirectoryIndex m["BConfig.WebConfig.StaticDir"] = BConfig.WebConfig.StaticDir m["BConfig.WebConfig.StaticExtensionsToGzip"] = BConfig.WebConfig.StaticExtensionsToGzip @@ -128,7 +128,7 @@ func listConf(rw http.ResponseWriter, r *http.Request) { m["BConfig.WebConfig.TemplateRight"] = BConfig.WebConfig.TemplateRight m["BConfig.WebConfig.ViewsPath"] = BConfig.WebConfig.ViewsPath m["BConfig.WebConfig.EnableXSRF"] = BConfig.WebConfig.EnableXSRF - m["BConfig.WebConfig.XSRFKEY"] = BConfig.WebConfig.XSRFKEY + m["BConfig.WebConfig.XSRFKEY"] = BConfig.WebConfig.XSRFKey m["BConfig.WebConfig.XSRFExpire"] = BConfig.WebConfig.XSRFExpire m["BConfig.WebConfig.Session.SessionOn"] = BConfig.WebConfig.Session.SessionOn m["BConfig.WebConfig.Session.SessionProvider"] = BConfig.WebConfig.Session.SessionProvider diff --git a/config.go b/config.go index 66702872..cffb7c2b 100644 --- a/config.go +++ b/config.go @@ -63,7 +63,7 @@ type WebConfig struct { AutoRender bool EnableDocs bool FlashName string - FlashSeperator string + FlashSeparator string DirectoryIndex bool StaticDir map[string]string StaticExtensionsToGzip []string @@ -71,7 +71,7 @@ type WebConfig struct { TemplateRight string ViewsPath string EnableXSRF bool - XSRFKEY string + XSRFKey string XSRFExpire int Session SessionConfig } @@ -141,7 +141,7 @@ func init() { AutoRender: true, EnableDocs: false, FlashName: "BEEGO_FLASH", - FlashSeperator: "BEEGOFLASH", + FlashSeparator: "BEEGOFLASH", DirectoryIndex: false, StaticDir: map[string]string{"/static": "static"}, StaticExtensionsToGzip: []string{".css", ".js"}, @@ -149,7 +149,7 @@ func init() { TemplateRight: "}}", ViewsPath: "views", EnableXSRF: false, - XSRFKEY: "beegoxsrf", + XSRFKey: "beegoxsrf", XSRFExpire: 0, Session: SessionConfig{ SessionOn: false, @@ -221,9 +221,9 @@ func ParseConfig() (err error) { BConfig.WebConfig.ViewsPath = AppConfig.DefaultString("ViewsPath", BConfig.WebConfig.ViewsPath) BConfig.WebConfig.DirectoryIndex = AppConfig.DefaultBool("DirectoryIndex", BConfig.WebConfig.DirectoryIndex) BConfig.WebConfig.FlashName = AppConfig.DefaultString("FlashName", BConfig.WebConfig.FlashName) - BConfig.WebConfig.FlashSeperator = AppConfig.DefaultString("FlashSeperator", BConfig.WebConfig.FlashSeperator) + BConfig.WebConfig.FlashSeparator = AppConfig.DefaultString("FlashSeparator", BConfig.WebConfig.FlashSeparator) BConfig.WebConfig.EnableDocs = AppConfig.DefaultBool("EnableDocs", BConfig.WebConfig.EnableDocs) - BConfig.WebConfig.XSRFKEY = AppConfig.DefaultString("XSRFKEY", BConfig.WebConfig.XSRFKEY) + BConfig.WebConfig.XSRFKey = AppConfig.DefaultString("XSRFKEY", BConfig.WebConfig.XSRFKey) BConfig.WebConfig.EnableXSRF = AppConfig.DefaultBool("EnableXSRF", BConfig.WebConfig.EnableXSRF) BConfig.WebConfig.XSRFExpire = AppConfig.DefaultInt("XSRFExpire", BConfig.WebConfig.XSRFExpire) BConfig.WebConfig.TemplateLeft = AppConfig.DefaultString("TemplateLeft", BConfig.WebConfig.TemplateLeft) diff --git a/config/config.go b/config/config.go index d0236003..da5d358b 100644 --- a/config/config.go +++ b/config/config.go @@ -29,12 +29,12 @@ // cnf.Int64(key string) (int64, error) // cnf.Bool(key string) (bool, error) // cnf.Float(key string) (float64, error) -// cnf.DefaultString(key string, defaultval string) string -// cnf.DefaultStrings(key string, defaultval []string) []string -// cnf.DefaultInt(key string, defaultval int) int -// cnf.DefaultInt64(key string, defaultval int64) int64 -// cnf.DefaultBool(key string, defaultval bool) bool -// cnf.DefaultFloat(key string, defaultval float64) float64 +// cnf.DefaultString(key string, defaultVal string) string +// cnf.DefaultStrings(key string, defaultVal []string) []string +// cnf.DefaultInt(key string, defaultVal int) int +// cnf.DefaultInt64(key string, defaultVal int64) int64 +// cnf.DefaultBool(key string, defaultVal bool) bool +// cnf.DefaultFloat(key string, defaultVal float64) float64 // cnf.DIY(key string) (interface{}, error) // cnf.GetSection(section string) (map[string]string, error) // cnf.SaveConfigFile(filename string) error @@ -48,19 +48,19 @@ import ( // Configer defines how to get and set value from configuration raw data. type Configer interface { - Set(key, val string) error // support section::key type in given key when using ini type. - String(key string) string // support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same. + Set(key, val string) error //support section::key type in given key when using ini type. + String(key string) string //support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same. Strings(key string) []string //get string slice Int(key string) (int, error) Int64(key string) (int64, error) Bool(key string) (bool, error) Float(key string) (float64, error) - DefaultString(key string, defaultval string) string // support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same. - DefaultStrings(key string, defaultval []string) []string //get string slice - DefaultInt(key string, defaultval int) int - DefaultInt64(key string, defaultval int64) int64 - DefaultBool(key string, defaultval bool) bool - DefaultFloat(key string, defaultval float64) float64 + DefaultString(key string, defaultVal string) string // support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same. + DefaultStrings(key string, defaultVal []string) []string //get string slice + DefaultInt(key string, defaultVal int) int + DefaultInt64(key string, defaultVal int64) int64 + DefaultBool(key string, defaultVal bool) bool + DefaultFloat(key string, defaultVal float64) float64 DIY(key string) (interface{}, error) GetSection(section string) (map[string]string, error) SaveConfigFile(filename string) error diff --git a/config_test.go b/config_test.go index a74471fc..cf4a781d 100644 --- a/config_test.go +++ b/config_test.go @@ -23,7 +23,7 @@ func TestDefaults(t *testing.T) { t.Errorf("FlashName was not set to default.") } - if BConfig.WebConfig.FlashSeperator != "BEEGOFLASH" { + if BConfig.WebConfig.FlashSeparator != "BEEGOFLASH" { t.Errorf("FlashName was not set to default.") } } diff --git a/controller.go b/controller.go index 3bc871cc..ab261a56 100644 --- a/controller.go +++ b/controller.go @@ -595,7 +595,7 @@ func (c *Controller) XSRFToken() string { if c.XSRFExpire > 0 { expire = int64(c.XSRFExpire) } - c._xsrfToken = c.Ctx.XSRFToken(BConfig.WebConfig.XSRFKEY, expire) + c._xsrfToken = c.Ctx.XSRFToken(BConfig.WebConfig.XSRFKey, expire) } return c._xsrfToken } diff --git a/flash.go b/flash.go index 123bfdc3..a6485a17 100644 --- a/flash.go +++ b/flash.go @@ -83,7 +83,7 @@ func (fd *FlashData) Store(c *Controller) { c.Data["flash"] = fd.Data var flashValue string for key, value := range fd.Data { - flashValue += "\x00" + key + "\x23" + BConfig.WebConfig.FlashSeperator + "\x23" + value + "\x00" + flashValue += "\x00" + key + "\x23" + BConfig.WebConfig.FlashSeparator + "\x23" + value + "\x00" } c.Ctx.SetCookie(BConfig.WebConfig.FlashName, url.QueryEscape(flashValue), 0, "/") } @@ -96,7 +96,7 @@ func ReadFromRequest(c *Controller) *FlashData { vals := strings.Split(v, "\x00") for _, v := range vals { if len(v) > 0 { - kv := strings.Split(v, "\x23"+BConfig.WebConfig.FlashSeperator+"\x23") + kv := strings.Split(v, "\x23"+BConfig.WebConfig.FlashSeparator+"\x23") if len(kv) == 2 { flash.Data[kv[0]] = kv[1] }