mirror of
https://gitee.com/johng/gf
synced 2026-06-06 02:25:47 +08:00
add golangci feature to guarantee codes quality (#2229)
This commit is contained in:
@ -61,6 +61,9 @@ type IUnwrap interface {
|
||||
const (
|
||||
// commandEnvKeyForBrief is the command environment name for switch key for brief error stack.
|
||||
commandEnvKeyForBrief = "gf.gerror.brief"
|
||||
|
||||
// commaSeparatorSpace is the comma separator with space.
|
||||
commaSeparatorSpace = ", "
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@ -17,7 +17,7 @@ import (
|
||||
func NewCode(code gcode.Code, text ...string) error {
|
||||
return &Error{
|
||||
stack: callers(),
|
||||
text: strings.Join(text, ", "),
|
||||
text: strings.Join(text, commaSeparatorSpace),
|
||||
code: code,
|
||||
}
|
||||
}
|
||||
@ -36,7 +36,7 @@ func NewCodef(code gcode.Code, format string, args ...interface{}) error {
|
||||
func NewCodeSkip(code gcode.Code, skip int, text ...string) error {
|
||||
return &Error{
|
||||
stack: callers(skip),
|
||||
text: strings.Join(text, ", "),
|
||||
text: strings.Join(text, commaSeparatorSpace),
|
||||
code: code,
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ func WrapCode(code gcode.Code, err error, text ...string) error {
|
||||
return &Error{
|
||||
error: err,
|
||||
stack: callers(),
|
||||
text: strings.Join(text, ", "),
|
||||
text: strings.Join(text, commaSeparatorSpace),
|
||||
code: code,
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ func WrapCodeSkip(code gcode.Code, skip int, err error, text ...string) error {
|
||||
return &Error{
|
||||
error: err,
|
||||
stack: callers(skip),
|
||||
text: strings.Join(text, ", "),
|
||||
text: strings.Join(text, commaSeparatorSpace),
|
||||
code: code,
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ var (
|
||||
|
||||
func init() {
|
||||
if goRootForFilter != "" {
|
||||
goRootForFilter = strings.Replace(goRootForFilter, "\\", "/", -1)
|
||||
goRootForFilter = strings.ReplaceAll(goRootForFilter, "\\", "/")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ import (
|
||||
// %v, %s : Print all the error string;
|
||||
// %-v, %-s : Print current level error string;
|
||||
// %+s : Print full stack error list;
|
||||
// %+v : Print the error string and full stack error list;
|
||||
// %+v : Print the error string and full stack error list
|
||||
func (err *Error) Format(s fmt.State, verb rune) {
|
||||
switch verb {
|
||||
case 's', 'v':
|
||||
|
||||
Reference in New Issue
Block a user