ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` func TestWriter() { data := []string{ "Channels orchestrate mutexes serialize", "Cgo is not Go", "Errors are values", "Don't panic", } var writer bytes.Buffer for _,p := range data{ fmt.Println("...") n, err := writer.Write([]byte(p)) if err != nil{ fmt.Println(n, err) os.Exit(1) } if n != len(p) { fmt.Println("n != p") os.Exit(1) } } fmt.Println(writer.String()) } ```