robpike / ivy

ivy, an APL-like calculator
Other
1.32k stars 103 forks source link

Require Go 1.21 #149

Closed mndrix closed 1 year ago

mndrix commented 1 year ago

Commit f024fcaf17 uses math/big.Int.Float64 which was introduced in Go version 1.21

dmitshur commented 1 year ago

Note that right now, Go 1.21 and Go 1.20 are the two major Go releases supported per the Go release policy. Go 1.20.x will be supported for another 6 months or so until Go 1.22.0 comes out.

Setting the go line to 1.21 makes that the minimum required version for this module, meaning Go users who haven't yet upgraded from Go 1.20 to 1.21 will not be able to import the latest versions of packages from this module, not unless they too upgrade their module to require 1.21.

Perhaps that's fine, just wanted to point this out.

An alternative to consider is to keep the go.mod go line at a lower version (like 1.20) and use a //go:build go1.21 build constraint in .go files that need it, and //go:build !go1.20 that provides a fallback implementation for Go 1.20 and older. (Edit: See PR #152 that illustrates this idea.)

mndrix commented 1 year ago

Point taken. Since Rob used Float64, I assumed the 1.21 dependency was intentional. If not, I withdraw the PR.

robpike commented 1 year ago

This particular result was not intentional, but I was planning to move to 1.21 pretty soon. Might as well do it now!