| OLD | NEW |
| 1 package common | 1 package common |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "fmt" | 4 "fmt" |
| 5 "strings" | 5 "strings" |
| 6 | 6 |
| 7 "go.skia.org/infra/fuzzer/go/config" | 7 "go.skia.org/infra/fuzzer/go/config" |
| 8 "go.skia.org/infra/go/gs" | 8 "go.skia.org/infra/go/gs" |
| 9 "google.golang.org/cloud/storage" | 9 "google.golang.org/cloud/storage" |
| 10 ) | 10 ) |
| 11 | 11 |
| 12 // GetAllFuzzNamesInFolder returns all the fuzz names in a given GCS folder. It
basically | 12 // GetAllFuzzNamesInFolder returns all the fuzz names in a given GCS folder. It
basically |
| 13 // returns a list of all files that don't end with a .dump or .err, or error | 13 // returns a list of all files that don't end with a .dump or .err, or error |
| 14 // if there was a problem. | 14 // if there was a problem. |
| 15 func GetAllFuzzNamesInFolder(s *storage.Client, name string) (hashes []string, e
rr error) { | 15 func GetAllFuzzNamesInFolder(s *storage.Client, name string) (hashes []string, e
rr error) { |
| 16 filter := func(item *storage.ObjectAttrs) { | 16 filter := func(item *storage.ObjectAttrs) { |
| 17 name := item.Name | 17 name := item.Name |
| 18 » » if strings.HasSuffix(name, ".dump") || strings.HasSuffix(name, "
.err") { | 18 » » if strings.Contains(name, ".") { |
| 19 return | 19 return |
| 20 } | 20 } |
| 21 fuzzHash := name[strings.LastIndex(name, "/")+1:] | 21 fuzzHash := name[strings.LastIndex(name, "/")+1:] |
| 22 hashes = append(hashes, fuzzHash) | 22 hashes = append(hashes, fuzzHash) |
| 23 } | 23 } |
| 24 | 24 |
| 25 if err = gs.AllFilesInDir(s, config.GS.Bucket, name, filter); err != nil
{ | 25 if err = gs.AllFilesInDir(s, config.GS.Bucket, name, filter); err != nil
{ |
| 26 return hashes, fmt.Errorf("Problem getting fuzzes from folder %s
: %s", name, err) | 26 return hashes, fmt.Errorf("Problem getting fuzzes from folder %s
: %s", name, err) |
| 27 } | 27 } |
| 28 return hashes, nil | 28 return hashes, nil |
| 29 } | 29 } |
| OLD | NEW |