optimize(bytesconv): add support for go1.20
What type of PR is this?
optimize
Check the PR title.
- [x] This PR title match the format: <type>(optional scope): <description>
- [x] The description of this PR title is user-oriented and clear enough for others to understand.
(Optional) Translate the PR title into Chinese.
bytesconv 增加 go1.20 的支持
(Optional) More detail description for this PR(en: English/zh: Chinese).
en:
go1.20 provides a truly safe(ish) APIs people can rely on, to ensure that subsequent go versions will not break b2s/s2b (no real world examples). refer to
https://github.com/golang/go/issues/53003
https://github.com/valyala/fasthttp/pull/1481
zh(optional):
使用 go1.20 提供的可以依赖的 api 去保证后续 go 版本不会破坏b2s/s2b(没有真实场景,不急)。参考
https://github.com/golang/go/issues/53003
https://github.com/valyala/fasthttp/pull/1481
Which issue(s) this PR fixes:
Codecov Report
Patch coverage: 100.00% and project coverage change: +1.78 :tada:
Comparison is base (
c98aec7) 72.49% compared to head (13b7d8f) 74.28%.
:exclamation: Current head 13b7d8f differs from pull request most recent head 50966b8. Consider uploading reports for the commit 50966b8 to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## develop #686 +/- ##
===========================================
+ Coverage 72.49% 74.28% +1.78%
===========================================
Files 96 100 +4
Lines 9392 9396 +4
===========================================
+ Hits 6809 6980 +171
+ Misses 2154 1985 -169
- Partials 429 431 +2
| Impacted Files | Coverage Δ | |
|---|---|---|
| internal/bytesconv/bytesconv.go | 89.71% <ø> (-1.04%) |
:arrow_down: |
| internal/bytesconv/b2s_new.go | 100.00% <100.00%> (ø) |
|
| internal/bytesconv/b2s_old.go | 100.00% <100.00%> (ø) |
|
| internal/bytesconv/s2b_new.go | 100.00% <100.00%> (ø) |
|
| internal/bytesconv/s2b_old.go | 100.00% <100.00%> (ø) |
... and 4 files with indirect coverage changes
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Is there any problem that related to current impl with Go1.20? For compatibility reasons, we currently may not change the minimum compatible version in go.mod🙏
Is there any problem that related to current impl with Go1.20? For compatibility reasons, we currently may not change the minimum compatible version in go.mod🙏
unsafe.SliceData/unsafe.StringData supported by 1.20
internal/bytesconv/b2s_new.go:52:23: unsafe.SliceData requires go1.20 or later (-lang was set to go1.16; check go.mod)
internal/bytesconv/s2b_new.go:50:22: unsafe.StringData requires go1.20 or later (-lang was set to go1.16; check go.mod)