This PR reverts changes from #1695 because they are unnecessary.
Short Explanation
According to the Go documentation on Build Constraints, the constraint go1.20 applies to go1.20, go1.21, go1.22, and so on. Conversely, !go1.20 applies to go1.18 and go1.19.
Here's the relevant excerpt from the documentation:
During a particular build, the following build tags are satisfied:
...
a term for each Go major release, through the current version: "go1.1" from Go version 1.1 onward, "go1.12" from Go 1.12, and so on.
Long Explanation
Currently, fasthttp supports the following Go versions: 1.18, 1.19, 1.20, 1.21, 1.22.
With build tags, we should ensure that:
s2b_new.go is included only when building with Go 1.20, 1.21, 1.22;
s2b_old.go is used for Go versions 1.18 and 1.19.
Let's implement the changes in this PR and list the files used for building with different Go versions.
This PR reverts changes from #1695 because they are unnecessary.
Short Explanation
According to the Go documentation on Build Constraints, the constraint
go1.20
applies togo1.20
,go1.21
,go1.22
, and so on. Conversely,!go1.20
applies togo1.18
andgo1.19
.Here's the relevant excerpt from the documentation:
Long Explanation
Currently,
fasthttp
supports the following Go versions:1.18
,1.19
,1.20
,1.21
,1.22
. With build tags, we should ensure that:s2b_new.go
is included only when building with Go1.20
,1.21
,1.22
;s2b_old.go
is used for Go versions1.18
and1.19
.Let's implement the changes in this PR and list the files used for building with different Go versions.
Go 1.18
This version compiles
s2b_old.go
:Right.
Go 1.19
This version compiles
s2b_old.go
:Right.
Go 1.20
This version compiles
s2b_new.go
:Yeah, this is what we want.
Go 1.21
This version compiles
s2b_new.go
:Right.
Go 1.22
This version compiles
s2b_new.go
:Cool.