Skip to content

Commit

Permalink
cmd/coordinator/internal/lucipoll: update for new JSONPB field naming
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dmitshur authored and gopherbot committed Sep 27, 2024
1 parent e2866b9 commit a411a18
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions cmd/coordinator/internal/lucipoll/lucipoll.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ type Builder struct {
}

type BuilderConfigProperties struct {
Repo string `json:"project,omitempty"`
GoBranch string `json:"go_branch,omitempty"`
Repo string `json:"project"`
GoBranch string `json:"go_branch"`
Target struct {
GOOS string `json:"goos,omitempty"`
GOARCH string `json:"goarch,omitempty"`
GOOS string `json:"goos"`
GOARCH string `json:"goarch"`
} `json:"target"`
KnownIssue int `json:"known_issue,omitempty"`
KnownIssue int `json:"known_issue"`
}

type Build struct {
Expand Down Expand Up @@ -242,11 +242,11 @@ func runOnce(
var buildOutputProps struct {
Sources []struct {
GitilesCommit struct {
Project string
Ref string
Id string
}
}
Project string `json:"project"`
Ref string `json:"ref"`
Id string `json:"id"`
} `json:"gitiles_commit"`
} `json:"sources"`
}
if data, err := b.GetOutput().GetProperties().MarshalJSON(); err != nil {
return nil, nil, fmt.Errorf("marshaling build output properties to JSON failed: %v", err)
Expand Down Expand Up @@ -330,11 +330,11 @@ func runOnce(
var buildOutputProps struct {
Sources []struct {
GitilesCommit struct {
Project string
Ref string
Id string
}
}
Project string `json:"project"`
Ref string `json:"ref"`
Id string `json:"id"`
} `json:"gitiles_commit"`
} `json:"sources"`
}
if data, err := b.GetOutput().GetProperties().MarshalJSON(); err != nil {
return nil, nil, fmt.Errorf("marshaling build output properties to JSON failed: %v", err)
Expand Down

0 comments on commit a411a18

Please sign in to comment.