bufio.NewReader.ReadString()中没有缓冲区大小限制吗?

I have a socket client that read response like this:

message, err := bufio.NewReader(conn).ReadString('
')

It works perfectly, but the ReadString method seems to have no limit on the buffer size.

Is it possible to add one? I didn't find much in bufio's document.

For example,

message, err := bufio.NewReaderSize(conn, 1024).ReadString('
')

To limit the data read, use an io.LimitedReader. For example,

rdr := bufio.NewReader(&io.LimitedReader{R: conn, N: 1024})
message, err := rdr.ReadString('
')