[BUG]Stock Exchange Losses - Golang unable to receive large input data

As stated here, the Go code for the Stock Exchange Losses puzzle seems unable to handle the large amount of input data given in example 5:

scanner := bufio.NewScanner(os.Stdin)

var n int
fmt.Fprintln(os.Stderr, "Count of data points:", n)

text := scanner.Text()
fmt.Fprintln(os.Stderr, "Full input text received:", text)

inputs := strings.Split(text, " ")
fmt.Fprintln(os.Stderr, "Count of actual inputs:", len(inputs))
fmt.Fprintln(os.Stderr, "Actual inputs:", inputs)

Which outputs this for example 2:

Count of data points: 6
Full input text received: 5 3 4 2 3 1
Count of actual inputs: 6
Actual inputs: [5 3 4 2 3 1]

And this for example 5:

Count of data points: 99999
Full input text received: 
Count of actual inputs: 1
Actual inputs: []

This is not true in javascript, where all the input data for example 5 is read correctly

i tried to investigate but got 100% reproduce of the case


I will try to solve this puzzle and I have the same issue. The issue is that the Scanner is limited to 64*1024.

For the 5th example, the following code will produce an error: bufio.Scanner: token too long

fmt.Fprintln(os.Stderr, scanner.Err())
text := scanner.Text()

I have checked the documentation and we can increase the maximum of the buffer size with the method Scanner.Buffer.
I try with this method but this method is only available in the version 1.6

Thank you rbouleau, looks like scanner.Buffer(make([]byte, 1000000), 1000000); fixes the issue for me.