[perf] Add types.CL as a type.

Bug: skia:10844
Change-Id: I9d2e63b7c96f8ec5c44cc2d3f816b0f03d5397d9
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/328296
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
diff --git a/perf/go/ingest/format/format.go b/perf/go/ingest/format/format.go
index df1e831..577b00b 100644
--- a/perf/go/ingest/format/format.go
+++ b/perf/go/ingest/format/format.go
@@ -7,6 +7,7 @@
 	"io"
 
 	"go.skia.org/infra/go/skerr"
+	"go.skia.org/infra/perf/go/types"
 )
 
 // FileFormatVersion is the version of this ingestion format.
@@ -120,7 +121,7 @@
 	GitHash string `json:"git_hash"`
 
 	// Issue is the Changelist ID.
-	Issue string `json:"issue"`
+	Issue types.CL `json:"issue"`
 
 	// Patchset is the tryjob patch identifier. For Gerrit this is an integer
 	// serialized as a string.
diff --git a/perf/go/ingest/parser/parser.go b/perf/go/ingest/parser/parser.go
index 7b96640..1d93af9 100644
--- a/perf/go/ingest/parser/parser.go
+++ b/perf/go/ingest/parser/parser.go
@@ -17,6 +17,7 @@
 	"go.skia.org/infra/perf/go/config"
 	"go.skia.org/infra/perf/go/file"
 	"go.skia.org/infra/perf/go/ingest/format"
+	"go.skia.org/infra/perf/go/types"
 )
 
 var (
@@ -207,7 +208,7 @@
 //
 // The issue and patch values are returned as strings. If either can be further
 // parsed as integers that will be done at a higher level.
-func (p *Parser) ParseTryBot(file file.File) (string, string, error) {
+func (p *Parser) ParseTryBot(file file.File) (types.CL, string, error) {
 	defer util.Close(file.Contents)
 	p.parseCounter.Inc(1)
 
@@ -232,7 +233,7 @@
 			p.parseFailCounter.Inc(1)
 			return "", "", skerr.Wrap(err)
 		}
-		return benchData.Issue, benchData.PatchSet, nil
+		return types.CL(benchData.Issue), benchData.PatchSet, nil
 	}
 	return parsed.Issue, parsed.Patchset, nil
 
diff --git a/perf/go/ingest/parser/parser_test.go b/perf/go/ingest/parser/parser_test.go
index c6984a1..0d8decc 100644
--- a/perf/go/ingest/parser/parser_test.go
+++ b/perf/go/ingest/parser/parser_test.go
@@ -15,6 +15,7 @@
 	"go.skia.org/infra/perf/go/config"
 	"go.skia.org/infra/perf/go/file"
 	"go.skia.org/infra/perf/go/ingest/format"
+	"go.skia.org/infra/perf/go/types"
 )
 
 const goodBranchName = "some-branch-name"
@@ -136,7 +137,7 @@
 func parseTryBot_Success(t *testing.T, p *Parser, f file.File) {
 	cl, patch, err := p.ParseTryBot(f)
 	require.NoError(t, err)
-	assert.Equal(t, "327697", cl)
+	assert.Equal(t, types.CL("327697"), cl)
 	assert.Equal(t, "1", patch)
 	assert.Equal(t, int64(1), p.parseCounter.Get())
 	assert.Equal(t, int64(0), p.parseFailCounter.Get())
diff --git a/perf/go/trybot/trybot.go b/perf/go/trybot/trybot.go
index 16776b3..ed05155 100644
--- a/perf/go/trybot/trybot.go
+++ b/perf/go/trybot/trybot.go
@@ -3,12 +3,14 @@
 
 import (
 	"time"
+
+	"go.skia.org/infra/perf/go/types"
 )
 
 // TryFile represents a single file of trybot results.
 type TryFile struct {
 	// CL is the Changelist Id.
-	CL string
+	CL types.CL
 
 	// PatchNumber is the index of the patch. Note this isn't the git hash of
 	// the patch.
diff --git a/perf/go/types/types.go b/perf/go/types/types.go
index 1f80d51..246cac9 100644
--- a/perf/go/types/types.go
+++ b/perf/go/types/types.go
@@ -156,3 +156,7 @@
 
 // ProgressCallback if a func that's called to return information on a currently running process.
 type ProgressCallback func(message string)
+
+// CL is the identifier for a change list, or pull request in GitHub
+// lingo.
+type CL string