[chore]: Bump codeberg.org/gruf/go-bytesize from 1.0.0 to 1.0.2 (#1285)
Bumps codeberg.org/gruf/go-bytesize from 1.0.0 to 1.0.2. --- updated-dependencies: - dependency-name: codeberg.org/gruf/go-bytesize dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
1659f75ae6
commit
abd594b71f
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module github.com/superseriousbusiness/gotosocial
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
codeberg.org/gruf/go-bytesize v1.0.0
|
codeberg.org/gruf/go-bytesize v1.0.2
|
||||||
codeberg.org/gruf/go-byteutil v1.0.2
|
codeberg.org/gruf/go-byteutil v1.0.2
|
||||||
codeberg.org/gruf/go-cache/v3 v3.2.0
|
codeberg.org/gruf/go-cache/v3 v3.2.0
|
||||||
codeberg.org/gruf/go-debug v1.2.0
|
codeberg.org/gruf/go-debug v1.2.0
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -64,8 +64,8 @@ codeberg.org/gruf/go-bitutil v1.0.1/go.mod h1:3ezHnADoiRJs9jgn65AEZ3HY7dsabAYLmm
|
||||||
codeberg.org/gruf/go-bytes v1.0.0/go.mod h1:1v/ibfaosfXSZtRdW2rWaVrDXMc9E3bsi/M9Ekx39cg=
|
codeberg.org/gruf/go-bytes v1.0.0/go.mod h1:1v/ibfaosfXSZtRdW2rWaVrDXMc9E3bsi/M9Ekx39cg=
|
||||||
codeberg.org/gruf/go-bytes v1.0.2 h1:malqE42Ni+h1nnYWBUAJaDDtEzF4aeN4uPN8DfMNNvo=
|
codeberg.org/gruf/go-bytes v1.0.2 h1:malqE42Ni+h1nnYWBUAJaDDtEzF4aeN4uPN8DfMNNvo=
|
||||||
codeberg.org/gruf/go-bytes v1.0.2/go.mod h1:1v/ibfaosfXSZtRdW2rWaVrDXMc9E3bsi/M9Ekx39cg=
|
codeberg.org/gruf/go-bytes v1.0.2/go.mod h1:1v/ibfaosfXSZtRdW2rWaVrDXMc9E3bsi/M9Ekx39cg=
|
||||||
codeberg.org/gruf/go-bytesize v1.0.0 h1:/Mcv4prniJLkPEqZ+LZ5/D/e27rNrZZEMmty9jpIvlc=
|
codeberg.org/gruf/go-bytesize v1.0.2 h1:Mo+ITi+0uZ4YNSZf2ed6Qw8acOI39W4mmgE1a8lslXw=
|
||||||
codeberg.org/gruf/go-bytesize v1.0.0/go.mod h1:n/GU8HzL9f3UNp/mUKyr1qVmTlj7+xacpp0OHfkvLPs=
|
codeberg.org/gruf/go-bytesize v1.0.2/go.mod h1:n/GU8HzL9f3UNp/mUKyr1qVmTlj7+xacpp0OHfkvLPs=
|
||||||
codeberg.org/gruf/go-byteutil v1.0.0/go.mod h1:cWM3tgMCroSzqoBXUXMhvxTxYJp+TbCr6ioISRY5vSU=
|
codeberg.org/gruf/go-byteutil v1.0.0/go.mod h1:cWM3tgMCroSzqoBXUXMhvxTxYJp+TbCr6ioISRY5vSU=
|
||||||
codeberg.org/gruf/go-byteutil v1.0.2 h1:OesVyK5VKWeWdeDR00zRJ+Oy8hjXx1pBhn7WVvcZWVE=
|
codeberg.org/gruf/go-byteutil v1.0.2 h1:OesVyK5VKWeWdeDR00zRJ+Oy8hjXx1pBhn7WVvcZWVE=
|
||||||
codeberg.org/gruf/go-byteutil v1.0.2/go.mod h1:cWM3tgMCroSzqoBXUXMhvxTxYJp+TbCr6ioISRY5vSU=
|
codeberg.org/gruf/go-byteutil v1.0.2/go.mod h1:cWM3tgMCroSzqoBXUXMhvxTxYJp+TbCr6ioISRY5vSU=
|
||||||
|
|
|
@ -1,3 +1 @@
|
||||||
Byte size formatting and parsing.
|
Byte size formatting and parsing.
|
||||||
|
|
||||||
todo: more robust tests
|
|
|
@ -3,6 +3,7 @@ package bytesize
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"math/bits"
|
"math/bits"
|
||||||
|
_ "strconv"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -52,18 +53,18 @@ var (
|
||||||
}
|
}
|
||||||
|
|
||||||
// bvals is a precomputed table of IEC unit values.
|
// bvals is a precomputed table of IEC unit values.
|
||||||
iecvals = [...]Size{
|
iecvals = [...]float64{
|
||||||
'k': KiB,
|
'k': float64(KiB),
|
||||||
'K': KiB,
|
'K': float64(KiB),
|
||||||
'M': MiB,
|
'M': float64(MiB),
|
||||||
'G': GiB,
|
'G': float64(GiB),
|
||||||
'T': TiB,
|
'T': float64(TiB),
|
||||||
'P': PiB,
|
'P': float64(PiB),
|
||||||
'E': EiB,
|
'E': float64(EiB),
|
||||||
}
|
}
|
||||||
|
|
||||||
// sivals is a precomputed table of SI unit values.
|
// sivals is a precomputed table of SI unit values.
|
||||||
sivals = [...]Size{
|
sivals = [...]float64{
|
||||||
// ASCII numbers _aren't_ valid SI unit values,
|
// ASCII numbers _aren't_ valid SI unit values,
|
||||||
// BUT if the space containing a possible unit
|
// BUT if the space containing a possible unit
|
||||||
// char is checked with this table -- it is valid
|
// char is checked with this table -- it is valid
|
||||||
|
@ -79,13 +80,13 @@ var (
|
||||||
'8': 1,
|
'8': 1,
|
||||||
'9': 1,
|
'9': 1,
|
||||||
|
|
||||||
'k': KB,
|
'k': float64(KB),
|
||||||
'K': KB,
|
'K': float64(KB),
|
||||||
'M': MB,
|
'M': float64(MB),
|
||||||
'G': GB,
|
'G': float64(GB),
|
||||||
'T': TB,
|
'T': float64(TB),
|
||||||
'P': PB,
|
'P': float64(PB),
|
||||||
'E': EB,
|
'E': float64(EB),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ func ParseSize(s string) (Size, error) {
|
||||||
return 0, ErrInvalidFormat
|
return 0, ErrInvalidFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
return Size(f) * unit, nil
|
return Size(f * unit), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set implements flag.Value{}.
|
// Set implements flag.Value{}.
|
||||||
|
@ -204,7 +205,7 @@ func (sz Size) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseUnit will parse the byte size unit from string 's'.
|
// parseUnit will parse the byte size unit from string 's'.
|
||||||
func parseUnit(s string) (Size, int, error) {
|
func parseUnit(s string) (float64, int, error) {
|
||||||
// Check for string
|
// Check for string
|
||||||
if len(s) < 1 {
|
if len(s) < 1 {
|
||||||
return 0, 0, ErrInvalidFormat
|
return 0, 0, ErrInvalidFormat
|
||||||
|
|
|
@ -7,7 +7,7 @@ codeberg.org/gruf/go-bitutil
|
||||||
# codeberg.org/gruf/go-bytes v1.0.2
|
# codeberg.org/gruf/go-bytes v1.0.2
|
||||||
## explicit; go 1.14
|
## explicit; go 1.14
|
||||||
codeberg.org/gruf/go-bytes
|
codeberg.org/gruf/go-bytes
|
||||||
# codeberg.org/gruf/go-bytesize v1.0.0
|
# codeberg.org/gruf/go-bytesize v1.0.2
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
codeberg.org/gruf/go-bytesize
|
codeberg.org/gruf/go-bytesize
|
||||||
# codeberg.org/gruf/go-byteutil v1.0.2
|
# codeberg.org/gruf/go-byteutil v1.0.2
|
||||||
|
|
Loading…
Reference in New Issue