On Fri, Sep 9, 2016 at 12:36 PM, <
vend...@gmail.com> wrote:
>
> On Friday, 9 September 2016 18:45:24 UTC+2, Ian Lance Taylor wrote:
>>
>> On Fri, Sep 9, 2016 at 7:22 AM, <
vend...@gmail.com> wrote:
>> >
>> > I was trying to read a longer text from stdin, without any newline. I
>> > tried
>> > it with many ways: fmt.Scan, bufio.NewScanner, bufio ReadLine,
>> > ioutil.ReadAll. A sample code looks like this:
>> >
>> >
stackoverflow.com/questions/27196195/golang-read-from-pipe-reads-tons-of-data#answer-27196786
>> > If the length was just a bit longer than 4096 characters, the result was
>> > always the same: it was cut at 4096 characters.
>> >
>> > When I saved the text to a file, and read from there, every method
>> > worked.
>> > If I changed the spaces to newlines, every method worked from stdin. So
>> > only
>> > this combination was wrong. Looks like a bug for me.
>> >
>> > I wanted to use it for
hackerrank.com excercises, where this is the
>> > typical
>> > input: long line given through stdin, without newline.
>> >
>> > Can anyone help me please?
>>
>> Show us the exact code you are running, and tell us about the system
>> on which you are running it.
>
GNU/Linux (look for N_TTY_BUF_SIZE in the kernel sources). That is
before hitting a newline. This has nothing to do with Go. I expect