[gold] Add expectations.Baseline type using string Labels.

Step 5 of the plan outlined in skbug.com/10522.

Bug: skia:10522
Change-Id: Idd428e54b461ea6c8a471b8c0691580ef7a6140d
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/304920
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Leandro Lovisolo <lovisolo@google.com>
diff --git a/gold-client/go/goldclient/resultstate.go b/gold-client/go/goldclient/resultstate.go
index c9363ee..8352ba5 100644
--- a/gold-client/go/goldclient/resultstate.go
+++ b/gold-client/go/goldclient/resultstate.go
@@ -145,7 +145,7 @@
 		return skerr.Wrapf(err, "parsing JSON; this sometimes means auth issues")
 	}
 
-	r.Expectations = exp.Expectations
+	r.Expectations = exp.ExpectationsInt
 	return nil
 }
 
diff --git a/golden/go/baseline/simple_baseliner/simple_baseliner.go b/golden/go/baseline/simple_baseliner/simple_baseliner.go
index ef56055..5daf3ad 100644
--- a/golden/go/baseline/simple_baseliner/simple_baseliner.go
+++ b/golden/go/baseline/simple_baseliner/simple_baseliner.go
@@ -37,9 +37,9 @@
 		b := baseline.Baseline{
 			ChangeListID:     "",
 			CodeReviewSystem: "",
-			Expectations:     exp.AsBaselineInt(),
+			ExpectationsInt:  exp.AsBaselineInt(),
 		}
-		md5Sum, err := util.MD5Sum(b.Expectations)
+		md5Sum, err := util.MD5Sum(b.ExpectationsInt)
 		if err != nil {
 			return nil, skerr.Wrapf(err, "calculating md5 hash of expectations")
 		}
@@ -61,7 +61,7 @@
 		return &baseline.Baseline{
 			ChangeListID:     clID,
 			CodeReviewSystem: crs,
-			Expectations:     iexp.AsBaselineInt(),
+			ExpectationsInt:  iexp.AsBaselineInt(),
 			MD5:              md5Sum,
 		}, nil
 	}
@@ -76,9 +76,9 @@
 	b := baseline.Baseline{
 		ChangeListID:     clID,
 		CodeReviewSystem: crs,
-		Expectations:     exp.AsBaselineInt(),
+		ExpectationsInt:  exp.AsBaselineInt(),
 	}
-	md5Sum, err := util.MD5Sum(b.Expectations)
+	md5Sum, err := util.MD5Sum(b.ExpectationsInt)
 	if err != nil {
 		return nil, skerr.Wrapf(err, "calculating md5 hash of expectations")
 	}
diff --git a/golden/go/baseline/simple_baseliner/simple_baseliner_test.go b/golden/go/baseline/simple_baseliner/simple_baseliner_test.go
index 23b1a41..a683caf 100644
--- a/golden/go/baseline/simple_baseliner/simple_baseliner_test.go
+++ b/golden/go/baseline/simple_baseliner/simple_baseliner_test.go
@@ -34,7 +34,7 @@
 	exp := three_devices.MakeTestExpectations()
 	expectedBaseline := exp.AsBaselineInt()
 
-	assert.Equal(t, expectedBaseline, b.Expectations)
+	assert.Equal(t, expectedBaseline, b.ExpectationsInt)
 	assert.Equal(t, masterBranch, b.ChangeListID)
 	assert.Equal(t, noCRS, b.CodeReviewSystem)
 	assert.NotEqual(t, "", b.MD5)
@@ -99,7 +99,7 @@
 			three_devices.BetaPositiveDigest:  expectations.NegativeInt,
 			three_devices.BetaUntriagedDigest: expectations.PositiveInt,
 		},
-	}, b.Expectations)
+	}, b.ExpectationsInt)
 
 	mes.On("GetCopy", testutils.AnyContext).Return(three_devices.MakeTestExpectations(), nil).Once()
 
diff --git a/golden/go/baseline/types.go b/golden/go/baseline/types.go
index 2f53963..69a59bd 100644
--- a/golden/go/baseline/types.go
+++ b/golden/go/baseline/types.go
@@ -15,7 +15,16 @@
 
 	// Expectations captures the "baseline expectations", that is, the Expectations with only the
 	// positive and negative digests (i.e. no untriaged digest) of the current commit.
-	Expectations expectations.BaselineInt `json:"master"`
+	//
+	// TODO(skbug.com/10522): Rename to json:"master" once the refactor from expectations.LabelStr to
+	//                 expectations.Label is finished.
+	Expectations expectations.Baseline `json:"master_str"`
+
+	// Expectations captures the "baseline expectations", that is, the Expectations with only the
+	// positive and negative digests (i.e. no untriaged digest) of the current commit.
+	//
+	// TODO(skbug.com/10522): Delete after expectations.LabelStr to expectations.Label is finished.
+	ExpectationsInt expectations.BaselineInt `json:"master"`
 
 	// ChangeListID indicates the Gerrit or GitHub issue id of this baseline.
 	// "" indicates the master branch.
diff --git a/golden/go/expectations/expectations.go b/golden/go/expectations/expectations.go
index bf6b188..4d1014e 100644
--- a/golden/go/expectations/expectations.go
+++ b/golden/go/expectations/expectations.go
@@ -25,8 +25,14 @@
 	labels map[types.TestName]map[types.Digest]Label
 }
 
-// BaselineInt is a simplified view of the Expectations, suitable for JSON encoding. A BaselineInt only
+// Baseline is a simplified view of the Expectations, suitable for JSON encoding. A BaselineInt only
 // has entries with positive and negative labels (i.e. no untriaged entries).
+type Baseline map[types.TestName]map[types.Digest]Label
+
+// BaselineInt is the LabelInt version of Baseline.
+//
+// Used by goldctl while the expectations.LabelStr -> expectations.Label migration is in progress.
+// TODO(skbug.com/10522): Delete once the aforementioned migration is finished.
 type BaselineInt map[types.TestName]map[types.Digest]LabelInt
 
 // ReadOnly is an interface with the non-mutating functions of Expectations.
diff --git a/golden/go/testutils/data_three_devices/three_devices.go b/golden/go/testutils/data_three_devices/three_devices.go
index eac8109..678f721 100644
--- a/golden/go/testutils/data_three_devices/three_devices.go
+++ b/golden/go/testutils/data_three_devices/three_devices.go
@@ -66,12 +66,12 @@
 func MakeTestBaseline() *baseline.Baseline {
 	e := MakeTestExpectations()
 	b := baseline.Baseline{
-		Expectations:     e.AsBaselineInt(),
+		ExpectationsInt:  e.AsBaselineInt(),
 		ChangeListID:     "",
 		CodeReviewSystem: "",
 	}
 	var err error
-	b.MD5, err = util.MD5Sum(b.Expectations)
+	b.MD5, err = util.MD5Sum(b.ExpectationsInt)
 	if err != nil {
 		panic(fmt.Sprintf("Error computing MD5 of the baseline: %s", err))
 	}
diff --git a/golden/go/web/web_test.go b/golden/go/web/web_test.go
index 2419a43..02268ac 100644
--- a/golden/go/web/web_test.go
+++ b/golden/go/web/web_test.go
@@ -1427,7 +1427,7 @@
 
 	// Prepare a fake response from the BaselineFetcher and the handler's expected JSON response.
 	bl := &baseline.Baseline{ChangeListID: "", MD5: "fakehash", CodeReviewSystem: "gerrit"}
-	expectedJSONResponse := `{"md5":"fakehash","master":null,"crs":"gerrit"}`
+	expectedJSONResponse := `{"md5":"fakehash","master_str":null,"master":null,"crs":"gerrit"}`
 
 	// FetchBaseline should be called as per the request parameters.
 	mbf.On("FetchBaseline", testutils.AnyContext, "" /* =clID */, "gerrit", false /* =issueOnly */).Return(bl, nil)
@@ -1468,7 +1468,7 @@
 
 	// Prepare a fake response from the BaselineFetcher and the handler's expected JSON response.
 	bl := &baseline.Baseline{ChangeListID: "", MD5: "fakehash", CodeReviewSystem: "gerrit"}
-	expectedJSONResponse := `{"md5":"fakehash","master":null,"crs":"gerrit"}`
+	expectedJSONResponse := `{"md5":"fakehash","master_str":null,"master":null,"crs":"gerrit"}`
 
 	// FetchBaseline should be called as per the request parameters.
 	mbf.On("FetchBaseline", testutils.AnyContext, "123456" /* =clID */, "gerrit", false /* =issueOnly */).Return(bl, nil)
@@ -1509,7 +1509,7 @@
 
 	// Prepare a fake response from the BaselineFetcher and the handler's expected JSON response.
 	bl := &baseline.Baseline{ChangeListID: "", MD5: "fakehash", CodeReviewSystem: "gerrit"}
-	expectedJSONResponse := `{"md5":"fakehash","master":null,"crs":"gerrit"}`
+	expectedJSONResponse := `{"md5":"fakehash","master_str":null,"master":null,"crs":"gerrit"}`
 
 	// FetchBaseline should be called as per the request parameters.
 	mbf.On("FetchBaseline", testutils.AnyContext, "123456" /* =clID */, "gerrit", true /* =issueOnly */).Return(bl, nil)
@@ -1586,7 +1586,7 @@
 
 	// Prepare a fake response from the BaselineFetcher and the handler's expected JSON response.
 	bl := &baseline.Baseline{ChangeListID: "", MD5: "fakehash", CodeReviewSystem: "gerrit"}
-	expectedJSONResponse := `{"md5":"fakehash","master":null,"crs":"gerrit"}`
+	expectedJSONResponse := `{"md5":"fakehash","master_str":null,"master":null,"crs":"gerrit"}`
 
 	// Note that the {commit_hash} doesn't appear anywhere in the FetchBaseline call.
 	mbf.On("FetchBaseline", testutils.AnyContext, "" /* =clID */, "gerrit", false /* =issueOnly */).Return(bl, nil)
@@ -1632,7 +1632,7 @@
 
 	// Prepare a fake response from the BaselineFetcher and the handler's expected JSON response.
 	bl := &baseline.Baseline{ChangeListID: "", MD5: "fakehash", CodeReviewSystem: "gerrit"}
-	expectedJSONResponse := `{"md5":"fakehash","master":null,"crs":"gerrit"}`
+	expectedJSONResponse := `{"md5":"fakehash","master_str":null,"master":null,"crs":"gerrit"}`
 
 	// Note that the {commit_hash} doesn't appear anywhere in the FetchBaseline call.
 	mbf.On("FetchBaseline", testutils.AnyContext, "123456" /* =clID */, "gerrit", false /* =issueOnly */).Return(bl, nil)
@@ -1678,7 +1678,7 @@
 
 	// Prepare a fake response from the BaselineFetcher and the handler's expected JSON response.
 	bl := &baseline.Baseline{ChangeListID: "", MD5: "fakehash", CodeReviewSystem: "gerrit"}
-	expectedJSONResponse := `{"md5":"fakehash","master":null,"crs":"gerrit"}`
+	expectedJSONResponse := `{"md5":"fakehash","master_str":null,"master":null,"crs":"gerrit"}`
 
 	// Note that the {commit_hash} doesn't appear anywhere in the FetchBaseline call.
 	mbf.On("FetchBaseline", testutils.AnyContext, "123456" /* =clID */, "gerrit", true /* =issueOnly */).Return(bl, nil)