vendor/github.com/pelletier/go-toml/marshal.go
changeset 260 445e01aede7e
parent 256 6d9efbef00a9
equal deleted inserted replaced
259:db4911b0c721 260:445e01aede7e
  1111 			val := reflect.ValueOf(tval)
  1111 			val := reflect.ValueOf(tval)
  1112 			if !val.Type().ConvertibleTo(mtype) || val.Kind() == reflect.Float64 {
  1112 			if !val.Type().ConvertibleTo(mtype) || val.Kind() == reflect.Float64 {
  1113 				return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String())
  1113 				return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String())
  1114 			}
  1114 			}
  1115 
  1115 
  1116 			if val.Convert(reflect.TypeOf(int(1))).Int() < 0 {
  1116 			if val.Type().Kind() != reflect.Uint64 && val.Convert(reflect.TypeOf(int(1))).Int() < 0 {
  1117 				return reflect.ValueOf(nil), fmt.Errorf("%v(%T) is negative so does not fit in %v", tval, tval, mtype.String())
  1117 				return reflect.ValueOf(nil), fmt.Errorf("%v(%T) is negative so does not fit in %v", tval, tval, mtype.String())
  1118 			}
  1118 			}
  1119 			if reflect.Indirect(reflect.New(mtype)).OverflowUint(val.Convert(reflect.TypeOf(uint64(0))).Uint()) {
  1119 			if reflect.Indirect(reflect.New(mtype)).OverflowUint(val.Convert(reflect.TypeOf(uint64(0))).Uint()) {
  1120 				return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String())
  1120 				return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String())
  1121 			}
  1121 			}