vendor: update all dependencies to latest versions
This commit is contained in:
+25
-16
@@ -11,6 +11,7 @@ import (
|
||||
"reflect"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/text/internal/format"
|
||||
"golang.org/x/text/internal/number"
|
||||
"golang.org/x/text/language"
|
||||
"golang.org/x/text/message/catalog"
|
||||
@@ -237,7 +238,7 @@ func (p *printer) fmtFloat(v float64, size int, verb rune) {
|
||||
if p.fmt.sharp || p.fmt.sharpV {
|
||||
p.fmt.fmt_float(v, size, verb, -1)
|
||||
} else {
|
||||
p.fmtVariableFloat(v, size, -1)
|
||||
p.fmtVariableFloat(v, size)
|
||||
}
|
||||
case 'e', 'E':
|
||||
if p.fmt.sharp || p.fmt.sharpV {
|
||||
@@ -284,7 +285,7 @@ func (p *printer) initDecimal(minFrac, maxFrac int) {
|
||||
f.MinIntegerDigits = 1
|
||||
f.MaxIntegerDigits = 0
|
||||
f.MinFractionDigits = uint8(minFrac)
|
||||
f.MaxFractionDigits = uint8(maxFrac)
|
||||
f.MaxFractionDigits = int16(maxFrac)
|
||||
p.setFlags(f)
|
||||
f.PadRune = 0
|
||||
if p.fmt.widPresent {
|
||||
@@ -308,8 +309,13 @@ func (p *printer) initDecimal(minFrac, maxFrac int) {
|
||||
|
||||
func (p *printer) initScientific(minFrac, maxFrac int) {
|
||||
f := &p.toScientific
|
||||
f.MinFractionDigits = uint8(minFrac)
|
||||
f.MaxFractionDigits = uint8(maxFrac)
|
||||
if maxFrac < 0 {
|
||||
f.SetPrecision(maxFrac)
|
||||
} else {
|
||||
f.SetPrecision(maxFrac + 1)
|
||||
f.MinFractionDigits = uint8(minFrac)
|
||||
f.MaxFractionDigits = int16(maxFrac)
|
||||
}
|
||||
f.MinExponentDigits = 2
|
||||
p.setFlags(f)
|
||||
f.PadRune = 0
|
||||
@@ -328,8 +334,6 @@ func (p *printer) initScientific(minFrac, maxFrac int) {
|
||||
|
||||
func (p *printer) fmtDecimalInt(v uint64, isSigned bool) {
|
||||
var d number.Decimal
|
||||
p.toDecimal.RoundingContext.Scale = 0
|
||||
d.ConvertInt(&p.toDecimal.RoundingContext, isSigned, v)
|
||||
|
||||
f := &p.toDecimal
|
||||
if p.fmt.precPresent {
|
||||
@@ -344,6 +348,7 @@ func (p *printer) fmtDecimalInt(v uint64, isSigned bool) {
|
||||
} else {
|
||||
p.initDecimal(0, 0)
|
||||
}
|
||||
d.ConvertInt(p.toDecimal.RoundingContext, isSigned, v)
|
||||
|
||||
out := p.toDecimal.Format([]byte(nil), &d)
|
||||
p.Buffer.Write(out)
|
||||
@@ -354,22 +359,21 @@ func (p *printer) fmtDecimalFloat(v float64, size, prec int) {
|
||||
if p.fmt.precPresent {
|
||||
prec = p.fmt.prec
|
||||
}
|
||||
p.toDecimal.RoundingContext.Scale = int32(prec)
|
||||
d.ConvertFloat(&p.toDecimal.RoundingContext, v, size)
|
||||
|
||||
p.initDecimal(prec, prec)
|
||||
d.ConvertFloat(p.toDecimal.RoundingContext, v, size)
|
||||
|
||||
out := p.toDecimal.Format([]byte(nil), &d)
|
||||
p.Buffer.Write(out)
|
||||
}
|
||||
|
||||
func (p *printer) fmtVariableFloat(v float64, size, prec int) {
|
||||
func (p *printer) fmtVariableFloat(v float64, size int) {
|
||||
prec := -1
|
||||
if p.fmt.precPresent {
|
||||
prec = p.fmt.prec
|
||||
}
|
||||
var d number.Decimal
|
||||
p.toScientific.RoundingContext.Precision = int32(prec)
|
||||
d.ConvertFloat(&p.toScientific.RoundingContext, v, size)
|
||||
p.initScientific(0, prec)
|
||||
d.ConvertFloat(p.toScientific.RoundingContext, v, size)
|
||||
|
||||
// Copy logic of 'g' formatting from strconv. It is simplified a bit as
|
||||
// we don't have to mind having prec > len(d.Digits).
|
||||
@@ -407,10 +411,9 @@ func (p *printer) fmtScientific(v float64, size, prec int) {
|
||||
if p.fmt.precPresent {
|
||||
prec = p.fmt.prec
|
||||
}
|
||||
p.toScientific.RoundingContext.Precision = int32(prec)
|
||||
d.ConvertFloat(&p.toScientific.RoundingContext, v, size)
|
||||
|
||||
p.initScientific(prec, prec)
|
||||
rc := p.toScientific.RoundingContext
|
||||
d.ConvertFloat(rc, v, size)
|
||||
|
||||
out := p.toScientific.Format([]byte(nil), &d)
|
||||
p.Buffer.Write(out)
|
||||
@@ -603,6 +606,12 @@ func (p *printer) handleMethods(verb rune) (handled bool) {
|
||||
return
|
||||
}
|
||||
// Is it a Formatter?
|
||||
if formatter, ok := p.arg.(format.Formatter); ok {
|
||||
handled = true
|
||||
defer p.catchPanic(p.arg, verb)
|
||||
formatter.Format(p, verb)
|
||||
return
|
||||
}
|
||||
if formatter, ok := p.arg.(fmt.Formatter); ok {
|
||||
handled = true
|
||||
defer p.catchPanic(p.arg, verb)
|
||||
@@ -1038,7 +1047,7 @@ formatLoop:
|
||||
p.fmt.plusV = p.fmt.plus
|
||||
p.fmt.plus = false
|
||||
}
|
||||
p.printArg(p.Arg(p.argNum), rune(c))
|
||||
p.printArg(p.Arg(p.argNum+1), rune(c))
|
||||
p.argNum++
|
||||
i++
|
||||
continue formatLoop
|
||||
|
||||
Reference in New Issue
Block a user