We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This doesn't compile. It should work.
package main import ( "bufio" "bytes" "fmt" "io" "strings" ) func main() { readers := As[io.Reader]( strings.NewReader(""), bufio.NewReader(strings.NewReader("")), bytes.NewBuffer([]byte("")), ) fmt.Printf("%T\n", readers) buffers1 := []*bytes.Buffer{ bytes.NewBuffer([]byte("")), bytes.NewBuffer([]byte("")), bytes.NewBuffer([]byte("")), bytes.NewBuffer([]byte("")), bytes.NewBuffer([]byte("")), } // breaders := As[io.Reader](buffers1...) stringrs := []*strings.Reader{ strings.NewReader(""), } strs := As[io.Reader](stringrs...) var all []io.Reader // all = append(all, buffers1...) all = Merge[io.Reader](breaders...) } func As[T any](in ...T) []T { return in }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This doesn't compile. It should work.
The text was updated successfully, but these errors were encountered: