a1f6039d by 傅小黑

gofmt code

1 parent 0183608a
...@@ -34,9 +34,9 @@ type FileCacheItem struct { ...@@ -34,9 +34,9 @@ type FileCacheItem struct {
34 34
35 var ( 35 var (
36 FileCachePath string = "cache" // cache directory 36 FileCachePath string = "cache" // cache directory
37 FileCacheFileSuffix string = ".bin" // cache file suffix 37 FileCacheFileSuffix string = ".bin" // cache file suffix
38 FileCacheDirectoryLevel int = 2 // cache file deep level if auto generated cache files. 38 FileCacheDirectoryLevel int = 2 // cache file deep level if auto generated cache files.
39 FileCacheEmbedExpiry int64 = 0 // cache expire time, default is no expire forever. 39 FileCacheEmbedExpiry int64 = 0 // cache expire time, default is no expire forever.
40 ) 40 )
41 41
42 // FileCache is cache adapter for file storage. 42 // FileCache is cache adapter for file storage.
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
7 // ConfigContainer defines how to get and set value from configuration raw data. 7 // ConfigContainer defines how to get and set value from configuration raw data.
8 type ConfigContainer interface { 8 type ConfigContainer interface {
9 Set(key, val string) error // support section::key type in given key when using ini type. 9 Set(key, val string) error // support section::key type in given key when using ini type.
10 String(key string) string // support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same. 10 String(key string) string // support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same.
11 Int(key string) (int, error) 11 Int(key string) (int, error)
12 Int64(key string) (int64, error) 12 Int64(key string) (int64, error)
13 Bool(key string) (bool, error) 13 Bool(key string) (bool, error)
......
...@@ -13,7 +13,7 @@ import ( ...@@ -13,7 +13,7 @@ import (
13 ) 13 )
14 14
15 var ( 15 var (
16 DEFAULT_SECTION = "default" // default section means if some ini items not in a section, make them in default section, 16 DEFAULT_SECTION = "default" // default section means if some ini items not in a section, make them in default section,
17 bNumComment = []byte{'#'} // number signal 17 bNumComment = []byte{'#'} // number signal
18 bSemComment = []byte{';'} // semicolon signal 18 bSemComment = []byte{';'} // semicolon signal
19 bEmpty = []byte{} 19 bEmpty = []byte{}
......
...@@ -53,7 +53,7 @@ func (c *JsonConfigContainer) Bool(key string) (bool, error) { ...@@ -53,7 +53,7 @@ func (c *JsonConfigContainer) Bool(key string) (bool, error) {
53 } else { 53 } else {
54 return false, errors.New("not exist key:" + key) 54 return false, errors.New("not exist key:" + key)
55 } 55 }
56 return false,nil 56 return false, nil
57 } 57 }
58 58
59 // Int returns the integer value for a given key. 59 // Int returns the integer value for a given key.
...@@ -68,7 +68,7 @@ func (c *JsonConfigContainer) Int(key string) (int, error) { ...@@ -68,7 +68,7 @@ func (c *JsonConfigContainer) Int(key string) (int, error) {
68 } else { 68 } else {
69 return 0, errors.New("not exist key:" + key) 69 return 0, errors.New("not exist key:" + key)
70 } 70 }
71 return 0,nil 71 return 0, nil
72 } 72 }
73 73
74 // Int64 returns the int64 value for a given key. 74 // Int64 returns the int64 value for a given key.
...@@ -83,7 +83,7 @@ func (c *JsonConfigContainer) Int64(key string) (int64, error) { ...@@ -83,7 +83,7 @@ func (c *JsonConfigContainer) Int64(key string) (int64, error) {
83 } else { 83 } else {
84 return 0, errors.New("not exist key:" + key) 84 return 0, errors.New("not exist key:" + key)
85 } 85 }
86 return 0,nil 86 return 0, nil
87 } 87 }
88 88
89 // Float returns the float value for a given key. 89 // Float returns the float value for a given key.
...@@ -98,7 +98,7 @@ func (c *JsonConfigContainer) Float(key string) (float64, error) { ...@@ -98,7 +98,7 @@ func (c *JsonConfigContainer) Float(key string) (float64, error) {
98 } else { 98 } else {
99 return 0.0, errors.New("not exist key:" + key) 99 return 0.0, errors.New("not exist key:" + key)
100 } 100 }
101 return 0.0,nil 101 return 0.0, nil
102 } 102 }
103 103
104 // String returns the string value for a given key. 104 // String returns the string value for a given key.
...@@ -132,7 +132,7 @@ func (c *JsonConfigContainer) DIY(key string) (v interface{}, err error) { ...@@ -132,7 +132,7 @@ func (c *JsonConfigContainer) DIY(key string) (v interface{}, err error) {
132 } else { 132 } else {
133 return nil, errors.New("not exist key") 133 return nil, errors.New("not exist key")
134 } 134 }
135 return nil,nil 135 return nil, nil
136 } 136 }
137 137
138 // section.key or key 138 // section.key or key
......
1
2 package config 1 package config
3 2
4 import ( 3 import (
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!