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

Unified Diff: milo/appengine/buildbot/build.go

Issue 2676503002: milo: Use struct for BuildBot properties. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | milo/appengine/buildbot/structs.go » ('j') | milo/appengine/buildbot/structs.go » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/buildbot/build.go
diff --git a/milo/appengine/buildbot/build.go b/milo/appengine/buildbot/build.go
index da257d368ff78e3e10302a1d6a9eb1699300bfbe..abfd303f66b77545b6e2824feb2e7bc4b91eacd6 100644
--- a/milo/appengine/buildbot/build.go
+++ b/milo/appengine/buildbot/build.go
@@ -15,11 +15,13 @@ import (
"strings"
"time"
- ds "github.com/luci/gae/service/datastore"
"github.com/luci/luci-go/common/data/stringset"
"github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/milo/api/resp"
"github.com/luci/luci-go/milo/common/miloerror"
+
+ ds "github.com/luci/gae/service/datastore"
+
"golang.org/x/net/context"
)
@@ -348,9 +350,9 @@ func properties(b *buildbotBuild) (result []*resp.PropertyGroup) {
groups := map[string]*resp.PropertyGroup{}
allProps := map[string]Prop{}
for _, prop := range b.Properties {
- allProps[prop[0].(string)] = Prop{
- Value: prop[1],
- Group: prop[2].(string),
+ allProps[prop.Name] = Prop{
+ Value: prop.Value,
+ Group: prop.Source,
}
}
for key, prop := range allProps {
@@ -420,27 +422,25 @@ func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
issue := int64(-1)
// TODO(hinoka): Gerrit URLs.
for _, prop := range b.Properties {
- key := prop[0].(string)
- value := prop[1]
- switch key {
+ switch prop.Name {
case "rietveld":
- if v, ok := value.(string); ok {
+ if v, ok := prop.Value.(string); ok {
rietveld = v
} else {
- logging.Warningf(c, "Field rietveld is not a string: %#v", value)
+ logging.Warningf(c, "Field rietveld is not a string: %#v", prop.Value)
}
case "issue":
- if v, ok := value.(float64); ok {
+ if v, ok := prop.Value.(float64); ok {
issue = int64(v)
} else {
- logging.Warningf(c, "Field issue is not a float: %#v", value)
+ logging.Warningf(c, "Field issue is not a float: %#v", prop.Value)
}
case "got_revision":
- if v, ok := value.(string); ok {
+ if v, ok := prop.Value.(string); ok {
ss.Revision = v
} else {
- logging.Warningf(c, "Field got_revision is not a string: %#v", value)
+ logging.Warningf(c, "Field got_revision is not a string: %#v", prop.Value)
}
}
« no previous file with comments | « no previous file | milo/appengine/buildbot/structs.go » ('j') | milo/appengine/buildbot/structs.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698