Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: golden/go/expstorage/sqlexpstore.go

Issue 650253003: Added HTTP endpoints for Correctness counts (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Fixed comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « golden/go/db/db.go ('k') | golden/go/skiacorrectness/main.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: golden/go/expstorage/sqlexpstore.go
diff --git a/golden/go/expstorage/sqlexpstore.go b/golden/go/expstorage/sqlexpstore.go
index 845e4a90d450cb23b3283a77abfa1a779977b5af..75d6571f684a9dd16578f217546f4eceeaee6b8f 100644
--- a/golden/go/expstorage/sqlexpstore.go
+++ b/golden/go/expstorage/sqlexpstore.go
@@ -1,6 +1,7 @@
package expstorage
import (
+ "database/sql"
"encoding/json"
"skia.googlesource.com/buildbot.git/go/database"
@@ -26,8 +27,13 @@ func (e *SQLExpectationsStore) Get(modifiable bool) (exp *Expectations, err erro
ORDER BY ts DESC
LIMIT 1`
+ // Read the expectations. If there are no rows, that means we have no
+ // expectations yet.
var expJSON string
- if err := e.vdb.DB.QueryRow(stmt).Scan(&expJSON); err != nil {
+ switch err := e.vdb.DB.QueryRow(stmt).Scan(&expJSON); {
+ case err == sql.ErrNoRows:
+ return NewExpectations(modifiable), nil
+ case err != nil:
return nil, err
}
« no previous file with comments | « golden/go/db/db.go ('k') | golden/go/skiacorrectness/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698