Skip to content

Commit a511f6a

Browse files
committed
Cleanup error handle
1 parent c430a2d commit a511f6a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

coderts/generate.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ func handleTypeSpec(typeSpec *ast.TypeSpec, pos token.Position) (string, error)
8989
continue
9090
}
9191

92-
fieldName, err := toJSONField(field)
93-
if err != nil || fieldType == "" {
92+
fieldName := toJSONField(field)
93+
if fieldType == "" {
9494
continue
9595
}
9696

@@ -169,7 +169,7 @@ func toTsType(fieldType string) string {
169169
return fieldType
170170
}
171171

172-
func toJSONField(field *ast.Field) (string, error) {
172+
func toJSONField(field *ast.Field) string {
173173
if field.Tag != nil && field.Tag.Value != "" {
174174
fieldName := strings.Trim(field.Tag.Value, "`")
175175
for _, pair := range strings.Split(fieldName, " ") {
@@ -178,10 +178,10 @@ func toJSONField(field *ast.Field) (string, error) {
178178
fieldName = strings.Trim(fieldName, `"`)
179179
fieldName = strings.Split(fieldName, ",")[0]
180180

181-
return fieldName, nil
181+
return fieldName
182182
}
183183
}
184184
}
185185

186-
return "", xerrors.New("no json tag")
186+
return ""
187187
}

0 commit comments

Comments
 (0)