commit
444675a2ae
@ -274,7 +274,7 @@ func (m *Migration) GetSQL() (sql string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(m.Primary) > 0 {
|
if len(m.Primary) > 0 {
|
||||||
sql += fmt.Sprintf(",\n PRIMARY KEY( ")
|
sql += ",\n PRIMARY KEY( "
|
||||||
}
|
}
|
||||||
for index, column := range m.Primary {
|
for index, column := range m.Primary {
|
||||||
sql += fmt.Sprintf(" `%s`", column.Name)
|
sql += fmt.Sprintf(" `%s`", column.Name)
|
||||||
@ -284,7 +284,7 @@ func (m *Migration) GetSQL() (sql string) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if len(m.Primary) > 0 {
|
if len(m.Primary) > 0 {
|
||||||
sql += fmt.Sprintf(")")
|
sql += ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, unique := range m.Uniques {
|
for _, unique := range m.Uniques {
|
||||||
@ -295,7 +295,7 @@ func (m *Migration) GetSQL() (sql string) {
|
|||||||
sql += ","
|
sql += ","
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sql += fmt.Sprintf(")")
|
sql += ")"
|
||||||
}
|
}
|
||||||
for _, foreign := range m.Foreigns {
|
for _, foreign := range m.Foreigns {
|
||||||
sql += fmt.Sprintf(",\n `%s` %s %s %s %s %s", foreign.Name, foreign.DataType, foreign.Unsign, foreign.Null, foreign.Inc, foreign.Default)
|
sql += fmt.Sprintf(",\n `%s` %s %s %s %s %s", foreign.Name, foreign.DataType, foreign.Unsign, foreign.Null, foreign.Inc, foreign.Default)
|
||||||
@ -356,7 +356,7 @@ func (m *Migration) GetSQL() (sql string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(m.Primary) > 0 {
|
if len(m.Primary) > 0 {
|
||||||
sql += fmt.Sprintf("\n DROP PRIMARY KEY,")
|
sql += "\n DROP PRIMARY KEY,"
|
||||||
}
|
}
|
||||||
|
|
||||||
for index, unique := range m.Uniques {
|
for index, unique := range m.Uniques {
|
||||||
|
|||||||
@ -99,12 +99,12 @@ func (c *JSONConfigContainer) sub(key string) (map[string]interface{}, error) {
|
|||||||
}
|
}
|
||||||
value, ok := c.data[key]
|
value, ok := c.data[key]
|
||||||
if !ok {
|
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{})
|
res, ok := value.(map[string]interface{})
|
||||||
if !ok {
|
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
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,11 +120,11 @@ func (c *ConfigContainer) sub(key string) (map[string]interface{}, error) {
|
|||||||
}
|
}
|
||||||
value, ok := c.data[key]
|
value, ok := c.data[key]
|
||||||
if !ok {
|
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{})
|
res, ok := value.(map[string]interface{})
|
||||||
if !ok {
|
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
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,7 @@ func (p *LogProject) ListLogStore() (storeNames []string, err error) {
|
|||||||
"x-sls-bodyrawsize": "0",
|
"x-sls-bodyrawsize": "0",
|
||||||
}
|
}
|
||||||
|
|
||||||
uri := fmt.Sprintf("/logstores")
|
uri := "/logstores"
|
||||||
r, err := request(p, "GET", uri, h, nil)
|
r, err := request(p, "GET", uri, h, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
@ -81,7 +81,7 @@ func (el *esLogger) Init(config string) error {
|
|||||||
if len(el.Formatter) > 0 {
|
if len(el.Formatter) > 0 {
|
||||||
fmtr, ok := logs.GetFormatter(el.Formatter)
|
fmtr, ok := logs.GetFormatter(el.Formatter)
|
||||||
if !ok {
|
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
|
el.formatter = fmtr
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,7 +120,7 @@ func (e *Email) Bytes() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
// Create the body sections
|
// Create the body sections
|
||||||
if e.Text != "" {
|
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")
|
header.Set("Content-Transfer-Encoding", "quoted-printable")
|
||||||
if _, err := subWriter.CreatePart(header); err != nil {
|
if _, err := subWriter.CreatePart(header); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -131,7 +131,7 @@ func (e *Email) Bytes() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if e.HTML != "" {
|
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")
|
header.Set("Content-Transfer-Encoding", "quoted-printable")
|
||||||
if _, err := subWriter.CreatePart(header); err != nil {
|
if _, err := subWriter.CreatePart(header); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@ -505,7 +505,7 @@ func defaultRecoverPanic(ctx *context.Context, cfg *Config) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
logs.Critical(fmt.Sprintf("%s:%d", file, line))
|
logs.Critical(fmt.Sprintf("%s:%d", file, line))
|
||||||
stack = stack + fmt.Sprintln(fmt.Sprintf("%s:%d", file, line))
|
stack += fmt.Sprintf("%s:%d\n", file, line)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Output.Status != 0 {
|
if ctx.Output.Status != 0 {
|
||||||
@ -629,7 +629,7 @@ func assignConfig(ac config.Configer) error {
|
|||||||
for adaptor, cfg := range BConfig.Log.Outputs {
|
for adaptor, cfg := range BConfig.Log.Outputs {
|
||||||
err := logs.SetLogger(adaptor, cfg)
|
err := logs.SetLogger(adaptor, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, fmt.Sprintf("%s with the config %q got err:%s", adaptor, cfg, err.Error()))
|
fmt.Fprintf(os.Stderr, "%s with the config %q got err:%s\n", adaptor, cfg, err.Error())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,7 +147,7 @@ func TestTask_Run(t *testing.T) {
|
|||||||
task := func(ctx context.Context) error {
|
task := func(ctx context.Context) error {
|
||||||
cnt++
|
cnt++
|
||||||
fmt.Printf("Hello, world! %d \n", cnt)
|
fmt.Printf("Hello, world! %d \n", cnt)
|
||||||
return errors.New(fmt.Sprintf("Hello, world! %d", cnt))
|
return fmt.Errorf("Hello, world! %d", cnt)
|
||||||
}
|
}
|
||||||
tk := NewTask("taska", "0/30 * * * * *", task)
|
tk := NewTask("taska", "0/30 * * * * *", task)
|
||||||
for i := 0; i < 200; i++ {
|
for i := 0; i < 200; i++ {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user