Skip to content

Commit a411a18

Browse files
dmitshurgopherbot
authored andcommitted
cmd/coordinator/internal/lucipoll: update for new JSONPB field naming
As of crrev.com/c/5875121, golangbuild switched to the new default behavior of using 'proto' field naming (such as "gitiles_commit") instead of using protobuf default names (such as "gitilesCommit"). The previous behavior can still be achieved by explicitly using the https://pkg.go.dev/go.chromium.org/luci/luciexe/build/properties#OptProtoUseJSONNames option, but we choose to accept the new default behavior since it's fine for our needs. So, update a few places in lucipoll for the new field naming pattern as was also recently done for watchflakes in CL 615515. Not handling the old pattern here since lucipoll only needs to handle new builds. Also drop the unused "omitempty" option from BuilderConfigProperties while here - it's never used for marshaling, only unmarshaling. For golang/go#69609. For golang/go#65913. Change-Id: Icf2f942fa9821f8781c9a2ecaddd2a3e10496ba2 Reviewed-on: https://go-review.googlesource.com/c/build/+/615976 Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent e2866b9 commit a411a18

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

cmd/coordinator/internal/lucipoll/lucipoll.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ type Builder struct {
3636
}
3737

3838
type BuilderConfigProperties struct {
39-
Repo string `json:"project,omitempty"`
40-
GoBranch string `json:"go_branch,omitempty"`
39+
Repo string `json:"project"`
40+
GoBranch string `json:"go_branch"`
4141
Target struct {
42-
GOOS string `json:"goos,omitempty"`
43-
GOARCH string `json:"goarch,omitempty"`
42+
GOOS string `json:"goos"`
43+
GOARCH string `json:"goarch"`
4444
} `json:"target"`
45-
KnownIssue int `json:"known_issue,omitempty"`
45+
KnownIssue int `json:"known_issue"`
4646
}
4747

4848
type Build struct {
@@ -242,11 +242,11 @@ func runOnce(
242242
var buildOutputProps struct {
243243
Sources []struct {
244244
GitilesCommit struct {
245-
Project string
246-
Ref string
247-
Id string
248-
}
249-
}
245+
Project string `json:"project"`
246+
Ref string `json:"ref"`
247+
Id string `json:"id"`
248+
} `json:"gitiles_commit"`
249+
} `json:"sources"`
250250
}
251251
if data, err := b.GetOutput().GetProperties().MarshalJSON(); err != nil {
252252
return nil, nil, fmt.Errorf("marshaling build output properties to JSON failed: %v", err)
@@ -330,11 +330,11 @@ func runOnce(
330330
var buildOutputProps struct {
331331
Sources []struct {
332332
GitilesCommit struct {
333-
Project string
334-
Ref string
335-
Id string
336-
}
337-
}
333+
Project string `json:"project"`
334+
Ref string `json:"ref"`
335+
Id string `json:"id"`
336+
} `json:"gitiles_commit"`
337+
} `json:"sources"`
338338
}
339339
if data, err := b.GetOutput().GetProperties().MarshalJSON(); err != nil {
340340
return nil, nil, fmt.Errorf("marshaling build output properties to JSON failed: %v", err)

0 commit comments

Comments
 (0)