I’m currently using go to do some course labs.I need a slice to store bufio.writer,here is what I do:
//slice to store bufio.writer
var bufferQ []interface{}
//bind file with buffer
writer := bufio.NewWriter(file)
bufferQ = append(bufferQ,writer)
But when I invoke it using following statements:bufferQ[0].WriteString(str), the compiler says something wrong:
# command-line-arguments
.\test.go:25:12: bufferQ[0].WriteString undefined (type interface {} is interface with no methods)
.\test.go:26:12: bufferQ[0].Flush undefined (type interface {} is interface with no methods)
Compilation finished with exit code 2