From 1dc4167c84a62de65868b60175a147dc35724937 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Wed, 14 Sep 2016 23:57:40 +0900 Subject: [PATCH] fix StringReader.__init__ initialization of buf and pos --- go/type.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go/type.go b/go/type.go index 50a1fcc..8971f41 100644 --- a/go/type.go +++ b/go/type.go @@ -180,10 +180,10 @@ func NewStringReader(lines []string) *StringReader { func (self *StringReader) __init__(lines []string) { size := 0 for _, l := range lines { - size += len(l) + size += len(l) + 1 // +1 for EOL } self.buf = make([]string, 0, size) - self.pos = make([]pos, 0, size) + self.pos = make([]pos, 0, size+1) // +1 for EOF var lnum = 0 for lnum < len(lines) { var col = 0