Skip to content

Commit d34ef40

Browse files
committed
bugfix: decimal use a test variable
The patch replaces usage of a test variable DecimalPrecision by a package-level variable decimalPrecision in the decimal package code.
1 parent 48cf0c7 commit d34ef40

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

decimal/decimal.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ func NewDecimalFromString(src string) (result *Decimal, err error) {
5858
// MarshalMsgpack serializes the Decimal into a MessagePack representation.
5959
func (decNum *Decimal) MarshalMsgpack() ([]byte, error) {
6060
one := decimal.NewFromInt(1)
61-
maxSupportedDecimal := decimal.New(1, DecimalPrecision).Sub(one) // 10^DecimalPrecision - 1
61+
maxSupportedDecimal := decimal.New(1, decimalPrecision).Sub(one) // 10^DecimalPrecision - 1
6262
minSupportedDecimal := maxSupportedDecimal.Neg().Sub(one) // -10^DecimalPrecision - 1
6363
if decNum.GreaterThan(maxSupportedDecimal) {
64-
return nil, fmt.Errorf("msgpack: decimal number is bigger than maximum supported number (10^%d - 1)", DecimalPrecision)
64+
return nil, fmt.Errorf("msgpack: decimal number is bigger than maximum supported number (10^%d - 1)", decimalPrecision)
6565
}
6666
if decNum.LessThan(minSupportedDecimal) {
67-
return nil, fmt.Errorf("msgpack: decimal number is lesser than minimum supported number (-10^%d - 1)", DecimalPrecision)
67+
return nil, fmt.Errorf("msgpack: decimal number is lesser than minimum supported number (-10^%d - 1)", decimalPrecision)
6868
}
6969

7070
strBuf := decNum.String()

0 commit comments

Comments
 (0)