Skip to content

Commit

Permalink
Make Go play nicely with omitempty. (#5673)
Browse files Browse the repository at this point in the history
Since `0` gets filtered by `omitempty` we need to make sure it actually
sends it.
  • Loading branch information
nathanhammond committed Aug 4, 2023
1 parent 7c06d75 commit 4745799
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cli/internal/runsummary/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ type spacesRunPayload struct {
EndTime int64 `json:"endTime,omitempty"` // when the run ended. we should never submit start and end at the same time.
Status string `json:"status,omitempty"` // Status is "running" or "completed"
Type string `json:"type,omitempty"` // hardcoded to "TURBO"
ExitCode int `json:"exitCode,omitempty"` // exit code for the full run
ExitCode *int `json:"exitCode,omitempty"` // exit code for the full run
Command string `json:"command,omitempty"` // the thing that kicked off the turbo run
RepositoryPath string `json:"repositoryPath,omitempty"` // where the command was invoked from
Context string `json:"context,omitempty"` // the host on which this Run was executed (e.g. Github Action, Vercel, etc)
Expand Down Expand Up @@ -289,7 +289,7 @@ type spacesTask struct {
StartTime int64 `json:"startTime,omitempty"`
EndTime int64 `json:"endTime,omitempty"`
Cache spacesCacheStatus `json:"cache,omitempty"`
ExitCode int `json:"exitCode,omitempty"`
ExitCode *int `json:"exitCode,omitempty"`
Dependencies []string `json:"dependencies,omitempty"`
Dependents []string `json:"dependents,omitempty"`
Logs string `json:"log"`
Expand Down Expand Up @@ -325,7 +325,7 @@ func newSpacesDonePayload(runsummary *RunSummary) *spacesRunPayload {
return &spacesRunPayload{
Status: "completed",
EndTime: endTime,
ExitCode: runsummary.ExecutionSummary.exitCode,
ExitCode: &runsummary.ExecutionSummary.exitCode,
}
}

Expand All @@ -341,7 +341,7 @@ func newSpacesTaskPayload(taskSummary *TaskSummary, logs []byte) *spacesTask {
StartTime: startTime,
EndTime: endTime,
Cache: spacesCacheStatus(taskSummary.CacheSummary), // wrapped so we can remove fields
ExitCode: *taskSummary.Execution.exitCode,
ExitCode: taskSummary.Execution.exitCode,
Dependencies: taskSummary.Dependencies,
Dependents: taskSummary.Dependents,
Logs: string(logs),
Expand Down

0 comments on commit 4745799

Please sign in to comment.