PS: You might be interested in the discussion about whether or not to allow this in the future: https://github.com/golang/go/issues/41716
On Sat, Dec 26, 2020 at 11:20 PM Axel Wagner <axel.wagner...@googlemail.com> wrote: > `Union[T, error]` is defined as > > interface { > type T, error > } > > An interface containing a type-list can only be used as a constraint. > However, you are using it as a type in several places. > > On Sat, Dec 26, 2020 at 10:22 PM thwd <sedeveloper...@gmail.com> wrote: > >> My (short) code: >> https://go2goplay.golang.org/p/J4Ovyt-4xXN >> >> The spec: >> >> https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md >> >> The errors: >> prog.go2:7:30: interface contains type constraints (T, error) >> prog.go2:19:32: interface contains type constraints (T, struct{}) >> prog.go2:10:13: interface contains type constraints (T, error) >> prog.go2:15:13: interface contains type constraints (T, error) >> prog.go2:22:13: interface contains type constraints (T, struct{}) >> >> What am I doing wrong? >> >> -- >> 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/6941a289-94b0-4bb1-99d2-c685652e46a8n%40googlegroups.com >> <https://groups.google.com/d/msgid/golang-nuts/6941a289-94b0-4bb1-99d2-c685652e46a8n%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/CAEkBMfFvbWj_nBD4t_3UtE%3D6UiJoVJT%2BcMjpnt-%3D8%2BXUF66E-A%40mail.gmail.com.