Fix lint and format code in server dir

This commit is contained in:
loyalsoldier
2021-06-06 21:38:59 +08:00
parent b420b064d2
commit 1023f83a92
48 changed files with 158 additions and 204 deletions

View File

@@ -55,29 +55,25 @@ func (f parserFunc) parse(value string, toType reflect.Type) (interface{}, error
return f(value, toType)
}
type boolParser struct {
}
type boolParser struct{}
func (p boolParser) parse(value string, toType reflect.Type) (interface{}, error) {
return strconv.ParseBool(value)
}
type stringParser struct {
}
type stringParser struct{}
func (p stringParser) parse(value string, toType reflect.Type) (interface{}, error) {
return value, nil
}
type intParser struct {
}
type intParser struct{}
func (p intParser) parse(value string, toType reflect.Type) (interface{}, error) {
return strconv.Atoi(value)
}
type floatParser struct {
}
type floatParser struct{}
func (p floatParser) parse(value string, toType reflect.Type) (interface{}, error) {
if toType.Kind() == reflect.Float32 {
@@ -90,8 +86,7 @@ func (p floatParser) parse(value string, toType reflect.Type) (interface{}, erro
return strconv.ParseFloat(value, 64)
}
type timeParser struct {
}
type timeParser struct{}
func (p timeParser) parse(value string, toType reflect.Type) (result interface{}, err error) {
result, err = time.Parse(time.RFC3339, value)
@@ -101,8 +96,7 @@ func (p timeParser) parse(value string, toType reflect.Type) (result interface{}
return
}
type jsonParser struct {
}
type jsonParser struct{}
func (p jsonParser) parse(value string, toType reflect.Type) (interface{}, error) {
pResult := reflect.New(toType)