Chromium Code Reviews| Index: milo/appengine/buildbot/structs.go |
| diff --git a/milo/appengine/buildbot/structs.go b/milo/appengine/buildbot/structs.go |
| index da95196c4b0f9f277b8d4b68802564af8852782a..05d2eb66620a96478bd029b82c357c66591cc9b1 100644 |
| --- a/milo/appengine/buildbot/structs.go |
| +++ b/milo/appengine/buildbot/structs.go |
| @@ -334,6 +334,27 @@ type buildbotChange struct { |
| Who string `json:"who"` |
| } |
| +func (bc *buildbotChange) GetFiles() []string { |
| + files := make([]string, len(bc.Files)) |
| + for i, f := range bc.Files { |
| + // Buildbot stores files both as a string, or as a dict with a single entry |
| + // named "name". It doesn't matter to us what the type is, but we need |
| + // to reflect on the type anyways. |
| + if fn, ok := f.(string); ok { |
|
nodir
2017/04/19 18:37:48
i think a type-switch would be cleaner here
hinoka
2017/04/20 22:09:43
Done.
|
| + files[i] = fn |
| + } else if fn, ok := f.(map[string]interface{}); ok { |
| + if name, ok := fn["name"]; ok { |
| + files[i] = fmt.Sprintf("%s", name) |
| + } else { |
| + files[i] = fmt.Sprintf("%#v", f) |
|
nodir
2017/04/19 18:37:48
i think if a user sees such as string, they would
nodir
2017/04/20 03:24:08
I meant omitting
hinoka
2017/04/20 22:09:43
Done. It just omits it without logging because I
|
| + } |
| + } else { |
| + files[i] = fmt.Sprintf("%#v", f) |
| + } |
| + } |
| + return files |
| +} |
| + |
| // buildbotSlave describes a slave on a master from a master json, and also includes the |
| // full builds of any currently running builds. |
| type buildbotSlave struct { |