@@ -99,12 +99,12 @@ func (c *JSONConfigContainer) sub(key string) (map[string]interface{}, error) {
|
||||
}
|
||||
value, ok := c.data[key]
|
||||
if !ok {
|
||||
return nil, errors.New(fmt.Sprintf("key is not found: %s", key))
|
||||
return nil, fmt.Errorf("key is not found: %s", key)
|
||||
}
|
||||
|
||||
res, ok := value.(map[string]interface{})
|
||||
if !ok {
|
||||
return nil, errors.New(fmt.Sprintf("the type of value is invalid, key: %s", key))
|
||||
return nil, fmt.Errorf("the type of value is invalid, key: %s", key)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@@ -120,11 +120,11 @@ func (c *ConfigContainer) sub(key string) (map[string]interface{}, error) {
|
||||
}
|
||||
value, ok := c.data[key]
|
||||
if !ok {
|
||||
return nil, errors.New(fmt.Sprintf("the key is not found: %s", key))
|
||||
return nil, fmt.Errorf("the key is not found: %s", key)
|
||||
}
|
||||
res, ok := value.(map[string]interface{})
|
||||
if !ok {
|
||||
return nil, errors.New(fmt.Sprintf("the value of this key is not a structure: %s", key))
|
||||
return nil, fmt.Errorf("the value of this key is not a structure: %s", key)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func (p *LogProject) ListLogStore() (storeNames []string, err error) {
|
||||
"x-sls-bodyrawsize": "0",
|
||||
}
|
||||
|
||||
uri := fmt.Sprintf("/logstores")
|
||||
uri := "/logstores"
|
||||
r, err := request(p, "GET", uri, h, nil)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
@@ -81,7 +81,7 @@ func (el *esLogger) Init(config string) error {
|
||||
if len(el.Formatter) > 0 {
|
||||
fmtr, ok := logs.GetFormatter(el.Formatter)
|
||||
if !ok {
|
||||
return errors.New(fmt.Sprintf("the formatter with name: %s not found", el.Formatter))
|
||||
return fmt.Errorf("the formatter with name: %s not found", el.Formatter)
|
||||
}
|
||||
el.formatter = fmtr
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ func (e *Email) Bytes() ([]byte, error) {
|
||||
}
|
||||
// Create the body sections
|
||||
if e.Text != "" {
|
||||
header.Set("Content-Type", fmt.Sprintf("text/plain; charset=UTF-8"))
|
||||
header.Set("Content-Type", "text/plain; charset=UTF-8")
|
||||
header.Set("Content-Transfer-Encoding", "quoted-printable")
|
||||
if _, err := subWriter.CreatePart(header); err != nil {
|
||||
return nil, err
|
||||
@@ -131,7 +131,7 @@ func (e *Email) Bytes() ([]byte, error) {
|
||||
}
|
||||
}
|
||||
if e.HTML != "" {
|
||||
header.Set("Content-Type", fmt.Sprintf("text/html; charset=UTF-8"))
|
||||
header.Set("Content-Type", "text/html; charset=UTF-8")
|
||||
header.Set("Content-Transfer-Encoding", "quoted-printable")
|
||||
if _, err := subWriter.CreatePart(header); err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user