Skip to content

Commit

Permalink
lint: stylecheck: fix default case should be first or last in switch …
Browse files Browse the repository at this point in the history
…statement
  • Loading branch information
ncw committed Apr 12, 2024
1 parent 818f37d commit e99f68c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xml/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,6 @@ func copyValue(dst reflect.Value, src []byte) (err error) {
switch dst.Kind() {
case reflect.Invalid:
// Probably a comment.
default:
return errors.New("cannot unmarshal into " + dst0.Type().String())
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
if len(src) == 0 {
dst.SetInt(0)
Expand Down Expand Up @@ -676,6 +674,8 @@ func copyValue(dst reflect.Value, src []byte) (err error) {
src = []byte{}
}
dst.SetBytes(src)
default:
return errors.New("cannot unmarshal into " + dst0.Type().String())
}
return nil
}
Expand Down

0 comments on commit e99f68c

Please sign in to comment.