Commit Graph

109 Commits

Author SHA1 Message Date
skyjerry 6e9731d50e Title: Fix ToUint64E function in cast library for Go
Detail:
The ToUint6E4 function in the Go cast library was fixed to correctly handle strings that overflow the maximum value of int64.

Previously, the function incorrectly returned zero for these input values because it was using strconv.ParseInt internally, which doesn't handle values greater than the max int64. The fix replaces the use of strconv.ParseInt with strconv.ParseUint.
2024-03-12 22:17:08 +08:00
Bjørn Erik Pedersen 48ddde5701 Bump Go version in go.mod to 1.19 2023-11-28 10:52:19 +01:00
Bjørn Erik Pedersen b09a6f848f deps: update to github.com/frankban/quicktest v1.14.6 2023-11-28 10:52:19 +01:00
Bjørn Erik Pedersen 268227c9f7 github: Replace the test workflow with the one used in Afero
Which is updated.
2023-11-28 10:52:19 +01:00
Márk Sági-Kazár e9ba3ce839
Merge pull request #190 from spf13/updates
Updates
2023-08-04 11:17:13 +02:00
Mark Sagi-Kazar 9d37e3a907
ci: fix dependabot config
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-08-04 11:13:12 +02:00
Mark Sagi-Kazar a441ac7fbe
ci: pin actions versions, fix checkout order
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-08-04 11:13:03 +02:00
Mark Sagi-Kazar 9c5e91d804
docs: update badges
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-08-04 11:09:44 +02:00
Mark Sagi-Kazar c49a664d4b
ci: rename ci.yml to ci.yaml
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-08-04 11:08:11 +02:00
Márk Sági-Kazár 0b4af69ad6
Merge pull request #185 from spf13/dependabot/go_modules/github.com/frankban/quicktest-1.14.5
Bump github.com/frankban/quicktest from 1.14.4 to 1.14.5
2023-08-04 11:04:58 +02:00
Márk Sági-Kazár 235f028989
Merge pull request #180 from spf13/dependabot/github_actions/actions/setup-go-4
Bump actions/setup-go from 3 to 4
2023-08-04 11:04:28 +02:00
Bjørn Erik Pedersen bbed5559a5 Pull the 2006-01-02 layout to the top when checking
The current top 2 formats are, from some checks I've done, 2 dominant formats used in Hugo projects.

Checking these first has a big effect:

```bash

name                  old time/op    new time/op    delta
CommonTimeLayouts-10    1.45µs ± 0%    0.33µs ± 1%  -77.45%  (p=0.029 n=4+4)

name                  old alloc/op   new alloc/op   delta
CommonTimeLayouts-10    1.55kB ± 0%    0.18kB ± 0%  -88.14%  (p=0.029 n=4+4)

name                  old allocs/op  new allocs/op  delta
CommonTimeLayouts-10      38.0 ± 0%       6.0 ± 0%  -84.21%  (p=0.029 n=4+4)
```

See https://github.com/gohugoio/hugo/issues/10942
2023-05-15 10:28:46 +02:00
dependabot[bot] f54f5eb09c
Bump github.com/frankban/quicktest from 1.14.4 to 1.14.5
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.14.4 to 1.14.5.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](https://github.com/frankban/quicktest/compare/v1.14.4...v1.14.5)

---
updated-dependencies:
- dependency-name: github.com/frankban/quicktest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-12 12:05:15 +00:00
dependabot[bot] f51fe10305
Bump actions/setup-go from 3 to 4
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-16 12:08:03 +00:00
Márk Sági-Kazár ba0a5b63c8
Merge pull request #153 from yveshield/more-int-to-bool
Add more integer to boolean conversions
2023-02-05 21:45:11 +01:00
dependabot[bot] 7ef7a18819 Bump github.com/frankban/quicktest from 1.14.3 to 1.14.4
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.14.3 to 1.14.4.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](https://github.com/frankban/quicktest/compare/v1.14.3...v1.14.4)

---
updated-dependencies:
- dependency-name: github.com/frankban/quicktest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-05 20:39:28 +00:00
Márk Sági-Kazár 5959a756af
Merge pull request #167 from spf13/improve-ci
Improve CI
2023-02-05 21:29:17 +01:00
Márk Sági-Kazár 1f57725177
Merge pull request #164 from qwxingzhe/patch-1
Correction of hugo URL error
2023-02-05 21:24:50 +01:00
Mark Sagi-Kazar 111af0b839
chore: improve badges in readme
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-02-05 21:23:57 +01:00
Mark Sagi-Kazar cb4b5fb396
ci: add a name to the build
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-02-05 21:21:24 +01:00
Mark Sagi-Kazar b7b9986f2c
ci: add dependabot config
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-02-05 21:20:35 +01:00
Mark Sagi-Kazar c9c46a1792
ci: add Go 1.19 and 1.20 to the build matrix
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-02-05 21:17:45 +01:00
Mark Sagi-Kazar 160eccf352
ci: general ci improvements
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-02-05 21:17:13 +01:00
行者 fa1a3528d1
Correction of hugo URL error
Correction of hugo URL error
2022-12-16 09:09:04 +08:00
yveshield 557a6a2fb7
Add more integer to boolean conversions
Signed-off-by: Yveshield <yveshield@gmail.com>
2022-09-03 13:22:36 +08:00
Bjørn Erik Pedersen 2b0eb0f724 Misc number fixes
* Allow strings/json.Number with just zeroes after the decmial point to be converted to integer`
* Allow nil in ToFloat*
* Remove some test duplication
* replace testify with quicktest
* Enable integer and float conversion of time.Weekday values

Fixes #139
Fixes #141
2022-05-11 15:55:47 +02:00
Bjørn Erik Pedersen 36a7d5b5b8 github: Update Go versions in matrix 2022-05-11 15:55:47 +02:00
yveshield 408043c8fa Add support for json.Number
Closes #115
Closes #61
2022-05-11 15:55:47 +02:00
Bjørn Erik Pedersen b481d74679
Add a simple ToInt benchmark 2022-05-11 13:07:20 +02:00
Kento Tsuji 88075729b0
Fix date parse for "2016-03-06 15:28:01 +0900" 2021-08-15 19:48:01 +02:00
Bjørn Erik Pedersen 3f42935ca9
github: Also run tests on Windows 2021-07-27 13:32:42 +02:00
Bjørn Erik Pedersen 02aebd9419
Update README.md 2021-07-27 13:28:33 +02:00
Bjørn Erik Pedersen a9f3cbf098
Remove .travis.yml
Use GitHub actions instead.
2021-07-27 13:24:54 +02:00
Bjørn Erik Pedersen 57c98fb578
Create go.yml 2021-07-27 13:23:44 +02:00
Bjørn Erik Pedersen 22b2b540ce
Adjust timezone logic 2021-07-27 13:05:07 +02:00
Heewa Barfchin e4dda5f5f1
Add ToTimeInDefaultLocation/E
Go's time parsing uses UTC when the format doesn't have a tiemzone, and
has even weirder behavior when it has a zone name but no numeric offset.
A caller to `cast.ToTime` won't know if the returned time was explicitly
in UTC, or defaulted there, so the caller cannot fix it. These new
functions allow a user to supply a different timezone to default to,
with nil using the local zone.
2021-07-27 13:05:07 +02:00
Bjørn Erik Pedersen c3e59ced67
travis: Bump Go versions 2021-07-27 13:03:57 +02:00
Paco Preciado Mendoza 8d17101741
Convert error slice to string slice
* feat: added test case for error slice to parse to string

* feat: added handler to convert an error slice to string slice
2020-07-23 23:45:38 +02:00
zheng 580a25aa7d feat: updating ToStringSliceE to support some other slices 2020-07-10 19:32:20 +02:00
K4rian 1ffadf5510 Fix uint, uint8, uint16, uint32 and uint64 conversion in ToStringE function. 2019-12-18 08:28:14 +01:00
Bjørn Erik Pedersen c01685bb84 travis: Only check gofmt on Go 1.12 2019-05-31 11:32:28 +02:00
Bjørn Erik Pedersen a924560ecf
travis: Add Go 1.12 2019-05-30 20:38:32 +02:00
Bjørn Erik Pedersen 8c9545af88 Fix Travis build 2018-10-25 00:59:28 +02:00
Bjørn Erik Pedersen 76b6d6c500
Add go.mod 2018-10-24 20:03:41 +02:00
Bjørn Erik Pedersen 97e58d71a3
Update Travis config 2018-10-24 20:02:32 +02:00
Theofanis Despoudis 4dd38b8b57 Add support for map of int64 and map of int 2018-10-24 20:00:14 +02:00
Ben Orchard efb632f0f6 tests: +date tests for RFC3339 no TZ colon cases 2018-10-21 23:25:45 +02:00
Ben Orchard 8934aa3ddd StringToDate: +more RFC3339 forms without TZ colon
Adds a form to handle the common format `strftime("%FT%T%z")`, which
omits the (optional) colon from the timezone. Also adds a matching
T-omitted form.
2018-10-21 23:25:45 +02:00
Xavier Vello 8965335b8c Add TestToDurationSliceE cases to reach 100% coverage 2018-02-14 18:49:49 +01:00
Xavier Vello 9ebc15c905 Add support for maps defined as a json string 2018-02-14 18:49:49 +01:00