On Wed, Jan 26, 2022 at 4:17 PM Kamil Ziemian <kziemian...@gmail.com> wrote: > > I accidentally initialize go.mod files for both tutorial on generics > (https://go.dev/doc/tutorial/generics) and for fuzzing > (https://go.dev/doc/tutorial/fuzz) with command > > go mod init example/nameOfSubject > and as a result both contains in respective go.mod file line > > go 1.17 > > In the case of generic mere writing function definition > > func SumIntsOrFloats[K comparable, V int64 | float64](m map[K]V) V { > > var s V > for _, v := range m { > s += v > } > return s > } > without even calling it produce a compile error > > ./main.go:39:22: type parameters require go1.18 or later > To make it work I needed to change go.mod file to this with proper version > 1.18. > > But in the case of fuzzing I have done all the examples from tutorial without > once encountering error of this type. > > Can anyone check if it have similar issue? I don't know if it is minor > problem or sign of some substantial flaw, but it is worth checking on few > machines.
Fuzzing is implemented in the tools, not the language itself, so if you are using the 1.18 tools it works regardless of the requested language version. Ian -- 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/CAOyqgcXXOFjarQv--_k7FJKzsZv7rzxpZxdm%2BeJcx%2B1Z0YGCCg%40mail.gmail.com.