diff options
-rw-r--r-- | gwic.go | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -12,12 +12,11 @@ import ( type queue struct { q []string - l int maxl int } func (q *queue) insert(s string) { - if len(q.q) < q.maxl { + if len(q.q) <= q.maxl { q.q = append(q.q, s) return } @@ -69,7 +68,7 @@ var ( kw string ) -const MAX int = 10 +const MAX int = 11 func main() { flag.Parse() @@ -81,7 +80,7 @@ func main() { tw = tabwriter.NewWriter(os.Stdout, 1, 1, 1, ' ', 0) splitreg := regexp.MustCompile("[ \t\n]") - q := queue{maxl: MAX, q: make([]string, MAX), l: MAX} + q := queue{maxl: MAX, q: make([]string, MAX)} sc := make(chan string, 1000) reader := bufio.NewReader(os.Stdin) |