Skip to content

build(deps): bump github.com/shopspring/decimal from 1.4.0 to 1.6.0 - #650

Open
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/go_modules/github.com/shopspring/decimal-1.6.0
Open

dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/go_modules/github.com/shopspring/decimal-1.6.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Nov 4, 2026

Copy link
Copy Markdown
Contributor

Bumps github.com/shopspring/decimal from 1.4.0 to 1.6.0.

Release notes

Sourced from github.com/shopspring/decimal's releases.

v1.6.0

What's Changed

New Contributors

Full Changelog: shopspring/decimal@v1.5.0...v1.6.0

v1.5.0

Full Changelog can be found in CHANGELOG.md. Please read its BEHAVIOR CHANGES section before upgrading.

New Contributors

Changelog

Sourced from github.com/shopspring/decimal's changelog.

Decimal v1.6.0

BEHAVIOR CHANGES

  • Decimal implements fmt.Formatter. %#v prints Go code that recreates the value, like decimal.New(314, -2), instead of the struct fields, and verbs that don't apply, like %d, print %!d(decimal.Decimal=3.14). %v, %s, %q, %x and fmt.Println print the same as before #463
  • Ln rounds correctly, so some results change in the last digit: Ln of 10 to 5 places is 2.30259, not 2.30258 #471
  • ExpHullAbrham returns overallPrecision significant figures for every input. Negative inputs used to lose digits or return 0, like -50 at precision 10, and large inputs returned extra digits #429 #470
  • Scan converts float32 with NewFromFloat32, so 54.33 stays 54.33 instead of becoming 54.33000183105469. NaN and infinite floats return an error instead of panicking #469
  • On Go 1.10 to 1.12, NewFromFloat can pick a different shortest form in rare cases (golang/go#29491). It still converts back to the same float #431

FEATURES

  • Add BSON Decimal128 support for Decimal and NullDecimal with the official MongoDB Go driver v2, without a new dependency #460
  • Add %f formatting with precision, width and flags, like %.2f and %08.2f #463
  • Add Normalize, which strips trailing zeros so equal decimals also match with reflect.DeepEqual, testify and gomock #464
  • Add Sqrt and SqrtRound #465
  • Add Root and RootRound for n-th roots #473
  • Add NewFromBigFloat constructor #457
  • Scan accepts Decimal, big.Int, *big.Int and all integer sizes, as passed by ClickHouse and other drivers #469

ENHANCEMENTS

  • NewFromFloat and NewFromFloat32 are 3 to 6 times faster. They use strconv instead of a vendored copy of it from 2009, which is removed #431
  • Ln is 3 to 14 times faster #471
  • Slightly faster IsInteger and Ceil #299
  • NewFromString accepts the Unicode minus sign − (U+2212) #428
  • Scanning NULL into a Decimal returns an error that points to NullDecimal or *Decimal #474
  • Document that global settings aren't goroutine-safe, and list them with their per-call alternatives in the README #466
  • README: show how to control the JSON format of one field, add udecimal to the alternative libraries, and update the Go doc and playground links #475 #476 #264
  • Fix doc examples that were wrong or didn't compile #468
  • Fix benchmarks that measured their setup or the wrong function #467

BUGFIXES

  • QuoRem and DivRound panic on precision math.MinInt32 instead of returning a wrong quotient #472

Decimal v1.5.0

BEHAVIOR CHANGES

  • NewFromString and UnmarshalBinary, and so JSON, text, SQL, gob and Spanner decoding, reject exponents larger than the new MaxDecodeExponent setting (default 10,000). Such input could hang the process or use gigabytes of memory. Raise MaxDecodeExponent if you need larger exponents #440
  • Pow, PowWithPrecision, PowInt32 and PowBigInt round correctly. Results for fractional exponents have PowPrecisionNegativeExponent (16) decimal places, and negative powers that used to return 0 keep 16 significant digits, so 10^-18 is 0.000000000000000001. Results too large to represent return an error, or 0 from Pow, instead of hanging or panicking #439
  • RoundUp, RoundDown, RoundCeil and RoundFloor always return exponent -places, like Round. Values don't change, but Exponent(), Coefficient() and String() with TrimTrailingZeros = false can #426 #441
  • Truncate supports negative precision: 5432 truncated to -2 is 5400. Before, it returned 5432 unchanged #426
  • Shift panics when the exponent overflows an int32, instead of wrapping around #437
  • NewFromString rejects a sign right after a leading decimal point, such as ".-5" #447

FEATURES

  • Add TrimTrailingZeros and UseScientificNotation settings for string output #389 #416
  • Add Spanner support with EncodeSpanner and DecodeSpanner for Decimal and NullDecimal #395

ENHANCEMENTS

  • Most operations are faster and allocate less, about twice as fast on average across the benchmarks #444 #445 #446 #447 #448 #449 #451
  • Faster UnmarshalJSON, Scan and NewFromString #403
  • ExpHullAbrham raises its partial sum to a power by squaring. Large inputs that took minutes now take seconds #450

... (truncated)

Commits
  • 447b833 docs: changelog for v1.6.0 (#477)
  • 4ce352f fix: reject overflowing division precision (#472)
  • 540b915 docs: add udecimal to the alternative libraries (#476)
  • 5474883 docs: show how to control the JSON format of one field (#475)
  • ddb96d1 fix: clearer error when scanning NULL into a Decimal (#474)
  • 59f775d README: Fix URLs for the official Go pages (#264)
  • 100aebf feat: add Root and RootRound (#473)
  • bed77f5 fix: Ln rounds correctly, computed with error bounds like Pow (#471)
  • 37aad64 feat: add NewFromBigFloat constructor (#457)
  • 78a38f8 perf: NewFromFloat uses strconv, drop the vendored strconv copy (#431)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [github.com/shopspring/decimal](https://github.com/shopspring/decimal) from 1.4.0 to 1.6.0.
- [Release notes](https://github.com/shopspring/decimal/releases)
- [Changelog](https://github.com/shopspring/decimal/blob/master/CHANGELOG.md)
- [Commits](shopspring/decimal@v1.4.0...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/shopspring/decimal
  dependency-version: 1.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file go Pull requests that update go code labels Nov 4, 2026

@leo-aa88 leo-aa88 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REQUEST CHANGES

This is a 1.4.0 → 1.6.0 jump across two minor releases, and both releases have a "BEHAVIOR CHANGES" section. One of those changes, MaxDecodeExponent in v1.5.0, breaks the database package's tests outright. go.mod/go.sum are consistent (go mod tidy -diff is clean). No pinned version constant for decimal exists anywhere in the repo, and the framework code paths (parseDecimal, types.Decimal decoding) already handle the new decode error by refusing, which is correct. The failure is in a test fixture, and because of it most of the CI matrix never ran.

  1. BLOCKING: TestDecimalGuardRefusesUnboundedSizeQuickly panics on RequireFromString("1e1000000000"). The concrete fix is inline.
  2. MAJOR: 14 jobs (all the real-driver Database, Conformance, Migrations, Fault-injection, Jobs and S3 jobs) were skipped, so the Scan/decode changes are unvalidated.
  3. MINOR: types.Decimal now accepts U+2212 minus, and the size-rule errors depend on the exponent. An upgrade-manifest note is suggested.

VERDICT

This is a test problem, not an implementation problem. The guard's contract ("a hostile exponent is refused without being formatted") still holds on v1.6.0. The test just can no longer build its hostile value with the parser that v1.5.0 hardened. Fix the fixture with decimal.New(...) as shown, then let the full matrix run. Don't merge until it is green.

Comment thread go.mod
github.com/pb33f/libopenapi-validator v0.16.1
github.com/redis/go-redis/v9 v9.22.0
github.com/shopspring/decimal v1.4.0
github.com/shopspring/decimal v1.6.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1. BLOCKING. The bump breaks database: TestDecimalGuardRefusesUnboundedSizeQuickly panics before it tests anything. (CONFIRMED, database/decimal_test.go:366-393; anchored here because the test file isn't in this diff)

decimal v1.5.0 added MaxDecodeExponent (default 10,000). NewFromString, and with it JSON, text, SQL and gob decoding, now rejects larger exponents. The test builds its hostile values with the parser:

for _, value := range []string{"1e1000000000", "0e1000000000", "-0e999999999", "0e-1000000000"} {
	hostile := decimal.RequireFromString(value)   // :367

On v1.6.0 that is a panic, which is what CI shows:

panic: can't convert 1e1000000000 to decimal: exponent 1000000000 exceeds MaxDecodeExponent (10000)
github.com/gombit-dev/gombit/database.TestDecimalGuardRefusesUnboundedSizeQuickly  database/decimal_test.go:367
FAIL	github.com/gombit-dev/gombit/database

The panic also hides every test in database that runs after it. The typed-create half of the test (types.Decimal{Decimal: decimal.RequireFromString(value)}, :390) has the same problem.

The guard is fine. It is the fixture that can no longer be built by parsing. Build the values without the parser, so they still reach DecimalStorageProblem and the write-path guard. Values with exponents this large can still exist in memory (from arithmetic or decimal.New), so the test still pins a real contract:

for _, h := range []struct {
	value string
	d     decimal.Decimal
}{
	{"1e1000000000", decimal.New(1, 1000000000)},
	{"0e1000000000", decimal.New(0, 1000000000)},
	{"-0e999999999", decimal.New(0, 999999999)},
	{"0e-1000000000", decimal.New(0, -1000000000)},
} {
	value, hostile := h.value, h.d

Do the same for the second loop, and use types.Decimal{Decimal: h.d} at :390. Keep Update("amount", value) with the string: that path now fails in parseDecimal's NewFromString and still has to come back as a *ValidationError. I applied exactly this change locally on this head, and go test ./database (sqlite) passes on decimal v1.6.0.

This is the same class of breakage as gombit-forge #224's pinned-decimal fix. The test hard-codes an assumption about what the dependency's parser accepts.

Comment thread go.mod
github.com/pb33f/libopenapi-validator v0.16.1
github.com/redis/go-redis/v9 v9.22.0
github.com/shopspring/decimal v1.4.0
github.com/shopspring/decimal v1.6.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2. MAJOR. Most of the CI matrix never ran on this bump. Test failed, so 14 jobs were skipped: Database (sqlite/postgres/mysql), Conformance ×3, Migrations ×3, Fault injection 1-6, Jobs (redis), Storage (s3) and Benchmark smoke. "Fault injection" is only the aggregator that reports the skips. v1.5/v1.6 change Scan (float32 now goes through NewFromFloat32; NULL gets a new error), UnmarshalBinary, and the MaxDecodeExponent limit on every SQL decode. The real-driver jobs are the ones that would catch a scan regression on MySQL DECIMAL(65,30) or PostgreSQL numeric. Nothing has exercised them here. After the fix in (1), the full matrix has to go green before this can merge.

Comment thread go.mod
github.com/pb33f/libopenapi-validator v0.16.1
github.com/redis/go-redis/v9 v9.22.0
github.com/shopspring/decimal v1.4.0
github.com/shopspring/decimal v1.6.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3. MINOR. Two quiet changes to types.Decimal's accepted input and its errors. (CONFIRMED with a probe against v1.6.0)

  • v1.6.0's NewFromString accepts the Unicode minus − (U+2212). types.Decimal.UnmarshalJSON, UnmarshalText and Scan all delegate to shopspring first. On this head, json.Unmarshal([]byte("−5"), &d) gives -5, nil, and on v1.4.0 it was an error. DecimalPattern (^-?[0-9]+(\.[0-9]+)?$) still advertises ASCII only. The parser was already wider than the pattern ("1e5", ".5"), so this widens an existing gap rather than opening a new one. Still, any path that skips huma's schema check (job payloads, UnmarshalText from config/query, admin's parseDecimalValue in admin/convert.go:135) now accepts a spelling it didn't accept before.
  • The size-rule errors now depend on the exponent. "1e5000" → decimal has more than 1000 digits (gombit's rule), but "1e50000" → error decoding string '"1e50000"': can't convert 1e50000 to decimal: exponent 50000 exceeds MaxDecodeExponent (10000). That second error leaks a shopspring setting name, because shopspring now refuses before checkSpelledDecimal runs. Both are still refused. Only the message changes.

Neither blocks the bump. types.Decimal embeds decimal.Decimal in the public API, so apps inherit all of v1.5/v1.6's BEHAVIOR CHANGES through MVS: RoundUp/Down/Ceil/Floor exponents, Pow/Ln results, %#v/%d formatting, and Truncate with negative precision. That's worth an informational kind: dependency entry in upgrade/manifest.yaml, like aws-sdk-updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant