Chromium Code Reviews| Index: ct/go/util/util.go |
| diff --git a/ct/go/util/util.go b/ct/go/util/util.go |
| index f126532cd9f9cfc8c4265e20e72c90c18c0dddc7..647deadccea15014856483c5508e9201a464f1ac 100644 |
| --- a/ct/go/util/util.go |
| +++ b/ct/go/util/util.go |
| @@ -3,6 +3,7 @@ package util |
| import ( |
| "bufio" |
| + "encoding/json" |
| "fmt" |
| "io" |
| "io/ioutil" |
| @@ -237,3 +238,21 @@ func ChromeProcessesCleaner(locker sync.Locker, chromeCleanerTimer time.Duration |
| locker.Unlock() |
| } |
| } |
| + |
| +type PagesetVars struct { |
|
dogben
2015/10/15 13:51:57
Nit: documentation.
rmistry
2015/10/15 14:21:56
Done.
|
| + UrlsList string `json:"urls_list"` |
| + UserAgent string `json:"user_agent"` |
| + ArchiveDataFile string `json:"archive_data_file"` |
| +} |
| + |
| +func ReadPageset(pagesetPath string) (PagesetVars, error) { |
| + decodedPageset := PagesetVars{} |
| + pagesetContent, err := os.Open(pagesetPath) |
| + if err != nil { |
| + return decodedPageset, fmt.Errorf("Could not read %s: %s", pagesetPath, err) |
| + } |
| + if err := json.NewDecoder(pagesetContent).Decode(&decodedPageset); err != nil { |
| + return decodedPageset, fmt.Errorf("Could not JSON decode %s: %s", pagesetPath, err) |
| + } |
| + return decodedPageset, nil |
| +} |