summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvan Jegen <s.jegen@gmail.com>2015-09-10 19:58:00 +0200
committerSilvan Jegen <s.jegen@gmail.com>2015-10-27 21:40:56 +0100
commitbdf6bcac460593b1be2eb103c0ea5ad2ba142f61 (patch)
tree5a30239b907b245383a76ef06c80ec2575804580
parent4aadde313e2aca87995c9344d20e5a8c5c9e1e7a (diff)
Fix counts
-rw-r--r--gwic.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/gwic.go b/gwic.go
index db35fca..5133557 100644
--- a/gwic.go
+++ b/gwic.go
@@ -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)