Skip to content

Commit

Permalink
github-pull-request-make: don't add packages with empty names
Browse files Browse the repository at this point in the history
When deleting a go test it was possible to add a package with an empty
name. This in turn would cause CI failure as the top-level cockroach
package contains no Go sources.

Release note: None
  • Loading branch information
petermattis committed Sep 4, 2018
1 parent 82d561f commit dc68d7f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions pkg/cmd/github-pull-request-make/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,19 @@ func pkgsFromDiff(r io.Reader) (map[string]pkg, error) {
curBenchmarkName = string(currentGoBenchmarkRE.ReplaceAll(line, []byte(replacement)))
curTestName = ""
case bytes.HasPrefix(line, []byte{'-'}) && bytes.Contains(line, []byte(".Skip")):
switch {
case len(curTestName) > 0:
if !(curPkgName == "build" && curTestName == "TestStyle") {
if curPkgName != "" {
switch {
case len(curTestName) > 0:
if !(curPkgName == "build" && curTestName == "TestStyle") {
curPkg := pkgs[curPkgName]
curPkg.tests = append(curPkg.tests, curTestName)
pkgs[curPkgName] = curPkg
}
case len(curBenchmarkName) > 0:
curPkg := pkgs[curPkgName]
curPkg.tests = append(curPkg.tests, curTestName)
curPkg.benchmarks = append(curPkg.benchmarks, curBenchmarkName)
pkgs[curPkgName] = curPkg
}
case len(curBenchmarkName) > 0:
curPkg := pkgs[curPkgName]
curPkg.benchmarks = append(curPkg.benchmarks, curBenchmarkName)
pkgs[curPkgName] = curPkg
}
}
}
Expand Down

0 comments on commit dc68d7f

Please sign in to comment.