Run go vet

Bugs found.
This commit is contained in:
kortschak 2014-08-28 12:22:37 +09:30
parent 8118c8d3cc
commit bf6412b55d
12 changed files with 28 additions and 14 deletions

View file

@ -103,7 +103,7 @@ func (it *AllIterator) Next() bool {
} else {
k, _ := cur.Seek(last)
if !bytes.Equal(k, last) {
return fmt.Errorf("could not pick up after", k)
return fmt.Errorf("could not pick up after %v", k)
}
}
for i < bufferSize {

View file

@ -148,7 +148,7 @@ func (it *Iterator) Next() bool {
} else {
k, _ := cur.Seek(last)
if !bytes.Equal(k, last) {
return fmt.Errorf("could not pick up after", k)
return fmt.Errorf("could not pick up after %v", k)
}
}
for i < bufferSize {

View file

@ -100,7 +100,7 @@ func (it *Fixed) DebugString(indent int) string {
if len(it.values) > 0 {
value = fmt.Sprint(it.values[0])
}
return fmt.Sprintf("%s(%s %d tags: %s Size: %d id0: %d)",
return fmt.Sprintf("%s(%s %d tags: %s Size: %d id0: %s)",
strings.Repeat(" ", indent),
it.Type(),
it.UID(),

View file

@ -154,7 +154,7 @@ func (it *Comparison) NextPath() bool {
return false
}
if it.doComparison(it.subIt.Result()) {
return true
break
}
}
it.result = it.subIt.Result()

View file

@ -137,7 +137,12 @@ func TestLoadDatabase(t *testing.T) {
}
w, _ := writer.NewSingleReplication(qs, nil)
w.AddQuad(quad.Quad{"Something", "points_to", "Something Else", "context"})
w.AddQuad(quad.Quad{
Subject: "Something",
Predicate: "points_to",
Object: "Something Else",
Label: "context",
})
for _, pq := range []string{"Something", "points_to", "Something Else", "context"} {
if got := qs.NameOf(qs.ValueOf(pq)); got != pq {
t.Errorf("Failed to roundtrip %q, got:%q expect:%q", pq, got, pq)
@ -171,7 +176,12 @@ func TestLoadDatabase(t *testing.T) {
t.Errorf("Unexpected quadstore size, got:%d expect:5", s)
}
w.RemoveQuad(quad.Quad{"A", "follows", "B", ""})
w.RemoveQuad(quad.Quad{
Subject: "A",
Predicate: "follows",
Object: "B",
Label: "",
})
if s := qs.Size(); s != 10 {
t.Errorf("Unexpected quadstore size after RemoveQuad, got:%d expect:10", s)
}

View file

@ -177,7 +177,12 @@ func TestLinksToOptimization(t *testing.T) {
func TestRemoveQuad(t *testing.T) {
qs, w, _ := makeTestStore(simpleGraph)
w.RemoveQuad(quad.Quad{"E", "follows", "F", ""})
w.RemoveQuad(quad.Quad{
Subject: "E",
Predicate: "follows",
Object: "F",
Label: "",
})
fixed := qs.FixedIterator()
fixed.Add(qs.ValueOf("E"))