Thanks Axel for your reply. That's interesting. I'm able to run your 
example just fine. However, using a different go.mod file with the content 
below (and a longer code example with iteration over a LevelDB thing... not 
able to provide the code), I get:

% gotip version
go version go1.21.0 darwin/arm64

% gotip run iter.go
# command-line-arguments
./iter.go:48:25: cannot range over SnapshotHash(ldb, nonce) (value of type 
Seq2[uint64, error])

module iter

go 1.21.0

require (
github.com/opencoff/go-fasthash v0.0.0-20180406145558-aed761496075
github.com/syndtr/goleveldb v1.0.0
)

require (
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
)


On Sunday, August 20, 2023 at 10:59:20 PM UTC-7 Axel Wagner wrote:

> Hm. For me, it still enables the rangefunc experiment, even though go.mod 
> says go 1.21:
>
> mero@vetinari ~/tmp/x$ gotip version
> go version devel go1.21-ca691a8566d Tue Jul 18 10:30:20 2023 -0400 (w/ 
> rangefunc) linux/amd64
> mero@vetinari ~/tmp/x$ cat go.mod
> module x
>
> go 1.21
> mero@vetinari ~/tmp/x$ cat x.go
> package main
>
> import "fmt"
>
> func main() {
>     s := []int{1, 2, 3}
>     for v := range All(s) {
>         fmt.Println(v)
>     }
> }
>
> func All[T any](s []T) func(yield func(T) bool) bool {
>     return func(yield func(T) bool) bool {
>         for _, v := range s {
>             if !yield(v) {
>                 return false
>             }
>         }
>         return true
>     }
> }
> mero@vetinari ~/tmp/x$ gotip run x.go
> 1
> 2
> 3
>
> On Fri, Aug 18, 2023 at 10:54 PM Hein Meling <hein....@gmail.com> wrote:
>
>> Hi all,
>>
>> I wanted to play around with the new range func CL 
>> <https://github.com/golang/go/issues/61405>.
>>
>> Doing simple stuff works just fine, but if I need to import packages to 
>> construct my custom iterator func, the go/gotip command insists on a go.mod 
>> file, which effectively resets the go version to 1.21.0 (due to go.mod), 
>> instead of the "(w/ rangefunc)" CL.
>>
>> Anyone know any workarounds for this?
>>
>> Thanks,
>> :) Hein
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/f01ff376-b789-4d8a-89f5-165a6527325fn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/f01ff376-b789-4d8a-89f5-165a6527325fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/09e1c142-0532-4d05-8dbe-6114fefdc2fdn%40googlegroups.com.

Reply via email to