Skip to content

Commit

Permalink
populate empty fields in statefile
Browse files Browse the repository at this point in the history
  • Loading branch information
aybabtme authored and Antoine Grondin committed Jan 14, 2023
1 parent b64828b commit 4f8145a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/humanlog/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func checkForUpdate(ctx context.Context, cfg *config.Config, state *state.State)

updateClient := cliupdatev1connect.NewUpdateServiceClient(httpClient, apiURL)
res, err := updateClient.GetNextUpdate(ctx, connect.NewRequest(&cliupdatepb.GetNextUpdateRequest{
ProjectName: "apictl", // "humanlog",
ProjectName: "humanlog",
CurrentVersion: version,
MachineArchitecture: runtime.GOARCH,
MachineOperatingSystem: runtime.GOOS,
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,11 @@ func (cfg State) populateEmpty(other *State) *State {
if out.MachineID == nil && other.MachineID != nil {
out.MachineID = other.MachineID
}
if out.LatestKnownVersion == nil && other.LatestKnownVersion != nil {
out.LatestKnownVersion = other.LatestKnownVersion
}
if out.LastestKnownVersionUpdatedAt == nil && other.LastestKnownVersionUpdatedAt != nil {
out.LastestKnownVersionUpdatedAt = other.LastestKnownVersionUpdatedAt
}
return &out
}

0 comments on commit 4f8145a

Please sign in to comment.