lint: finish errcheck — zero remaining
Fix final cW calls in middleware/recoverer.go and sendTextCommandResponse in platform/text/text.go.
This commit is contained in:
parent
7270de2937
commit
d74c24339e
2 changed files with 18 additions and 16 deletions
|
|
@ -77,10 +77,10 @@ func (s prettyStack) parse(debugStack []byte, rvr interface{}) ([]byte, error) {
|
||||||
useColor := true
|
useColor := true
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
|
|
||||||
cW(buf, false, bRed, "\n")
|
_ = cW(buf, false, bRed, "\n")
|
||||||
cW(buf, useColor, bCyan, " panic: ")
|
_ = cW(buf, useColor, bCyan, " panic: ")
|
||||||
cW(buf, useColor, bBlue, "%v", rvr)
|
_ = cW(buf, useColor, bBlue, "%v", rvr)
|
||||||
cW(buf, false, bWhite, "\n \n")
|
_ = cW(buf, false, bWhite, "\n \n")
|
||||||
|
|
||||||
// process debug stack info
|
// process debug stack info
|
||||||
stack := strings.Split(string(debugStack), "\n")
|
stack := strings.Split(string(debugStack), "\n")
|
||||||
|
|
@ -157,14 +157,14 @@ func (s prettyStack) decorateFuncCallLine(line string, useColor bool, num int) (
|
||||||
methodColor := bGreen
|
methodColor := bGreen
|
||||||
|
|
||||||
if num == 0 {
|
if num == 0 {
|
||||||
cW(buf, useColor, bRed, " -> ")
|
_ = cW(buf, useColor, bRed, " -> ")
|
||||||
pkgColor = bMagenta
|
pkgColor = bMagenta
|
||||||
methodColor = bRed
|
methodColor = bRed
|
||||||
} else {
|
} else {
|
||||||
cW(buf, useColor, bWhite, " ")
|
_ = cW(buf, useColor, bWhite, " ")
|
||||||
}
|
}
|
||||||
cW(buf, useColor, pkgColor, "%s", pkg)
|
_ = cW(buf, useColor, pkgColor, "%s", pkg)
|
||||||
cW(buf, useColor, methodColor, "%s\n", method)
|
_ = cW(buf, useColor, methodColor, "%s\n", method)
|
||||||
// cW(buf, useColor, nBlack, "%s", addr)
|
// cW(buf, useColor, nBlack, "%s", addr)
|
||||||
return buf.String(), nil
|
return buf.String(), nil
|
||||||
}
|
}
|
||||||
|
|
@ -191,19 +191,19 @@ func (s prettyStack) decorateSourceLine(line string, useColor bool, num int) (st
|
||||||
lineColor := bGreen
|
lineColor := bGreen
|
||||||
|
|
||||||
if num == 1 {
|
if num == 1 {
|
||||||
cW(buf, useColor, bRed, " -> ")
|
_ = cW(buf, useColor, bRed, " -> ")
|
||||||
fileColor = bRed
|
fileColor = bRed
|
||||||
lineColor = bMagenta
|
lineColor = bMagenta
|
||||||
} else {
|
} else {
|
||||||
cW(buf, false, bWhite, " ")
|
_ = cW(buf, false, bWhite, " ")
|
||||||
}
|
}
|
||||||
cW(buf, useColor, bWhite, "%s", dir)
|
_ = cW(buf, useColor, bWhite, "%s", dir)
|
||||||
cW(buf, useColor, fileColor, "%s", file)
|
_ = cW(buf, useColor, fileColor, "%s", file)
|
||||||
cW(buf, useColor, lineColor, "%s", lineno)
|
_ = cW(buf, useColor, lineColor, "%s", lineno)
|
||||||
if num == 1 {
|
if num == 1 {
|
||||||
cW(buf, false, bWhite, "\n")
|
_ = cW(buf, false, bWhite, "\n")
|
||||||
}
|
}
|
||||||
cW(buf, false, bWhite, "\n")
|
_ = cW(buf, false, bWhite, "\n")
|
||||||
|
|
||||||
return buf.String(), nil
|
return buf.String(), nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,9 @@ func respondText(ctx context.Context, log_id int32) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("Failed to wipe memory")
|
log.Error().Err(err).Msg("Failed to wipe memory")
|
||||||
content := "Failed to wipe memory"
|
content := "Failed to wipe memory"
|
||||||
sendTextCommandResponse(ctx, txn, *src, content)
|
lint.LogOnErrCtx(func(ctx context.Context) error {
|
||||||
|
return sendTextCommandResponse(ctx, txn, *src, content)
|
||||||
|
}, ctx, "send text command response")
|
||||||
return fmt.Errorf("reset conversation: %w", err)
|
return fmt.Errorf("reset conversation: %w", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue