add golangci feature to guarantee codes quality (#2229)

This commit is contained in:
houseme
2022-11-01 20:12:21 +08:00
committed by GitHub
parent 8e0e87877a
commit 1793bf0863
255 changed files with 1123 additions and 690 deletions

View File

@ -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 (

View File

@ -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,
}
}

View File

@ -35,7 +35,7 @@ var (
func init() {
if goRootForFilter != "" {
goRootForFilter = strings.Replace(goRootForFilter, "\\", "/", -1)
goRootForFilter = strings.ReplaceAll(goRootForFilter, "\\", "/")
}
}

View File

@ -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':