lint: stylecheck: fix default case should be first or last in switch statement

This commit is contained in:
Nick Craig-Wood
2024-04-12 16:59:36 +01:00
parent 818f37db44
commit e99f68c813

View File

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