From 049d1aa238eb8821d780a75b8dad25cd5167cd75 Mon Sep 17 00:00:00 2001 From: mitchell Date: Fri, 15 Dec 2023 11:01:56 -0500 Subject: [PATCH] Switch back to strfmt.DateTime in buildplanner structs. --- internal/runbits/requirements/requirements.go | 4 +++- internal/runners/initialize/init.go | 2 +- pkg/platform/model/buildplanner.go | 4 ++-- pkg/platform/runtime/buildexpression/buildexpression.go | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/runbits/requirements/requirements.go b/internal/runbits/requirements/requirements.go index 479271424c..bc736fb390 100644 --- a/internal/runbits/requirements/requirements.go +++ b/internal/runbits/requirements/requirements.go @@ -30,6 +30,7 @@ import ( "github.com/ActiveState/cli/pkg/platform/model" "github.com/ActiveState/cli/pkg/platform/runtime/target" "github.com/ActiveState/cli/pkg/project" + "github.com/go-openapi/strfmt" ) type PackageVersion struct { @@ -240,6 +241,7 @@ func (r *RequirementOperation) ExecuteRequirementOperation( } ts = &latest } + timestamp := strfmt.DateTime(*ts) // MUST ADDRESS: we're no longer passing bitwidth, but this needs it. Need to figure out why. requirementBitWidth := -1 @@ -262,7 +264,7 @@ func (r *RequirementOperation) ExecuteRequirementOperation( RequirementVersion: requirements, RequirementNamespace: *ns, Operation: operation, - TimeStamp: ts, + TimeStamp: ×tamp, } bp := model.NewBuildPlannerModel(r.Auth) diff --git a/internal/runners/initialize/init.go b/internal/runners/initialize/init.go index 12ba69d66d..e04abe913b 100644 --- a/internal/runners/initialize/init.go +++ b/internal/runners/initialize/init.go @@ -251,7 +251,7 @@ func (r *Initialize) Run(params *RunParams) (rerr error) { Language: lang.Requirement(), Version: version, Private: params.Private, - Timestamp: timestamp, + Timestamp: strfmt.DateTime(timestamp), Description: locale.T("commit_message_add_initial"), }) if err != nil { diff --git a/pkg/platform/model/buildplanner.go b/pkg/platform/model/buildplanner.go index 95339e1d38..18a11603ce 100644 --- a/pkg/platform/model/buildplanner.go +++ b/pkg/platform/model/buildplanner.go @@ -225,7 +225,7 @@ type StageCommitParams struct { RequirementVersion []bpModel.VersionRequirement RequirementNamespace Namespace Operation bpModel.Operation - TimeStamp *time.Time + TimeStamp *strfmt.DateTime // ... or commits can have an expression (e.g. from pull). When pulling an expression, we do not // compute its changes into a series of above operations. Instead, we just pass the new // expression directly. @@ -329,7 +329,7 @@ type CreateProjectParams struct { Language string Version string Private bool - Timestamp time.Time + Timestamp strfmt.DateTime Description string Expr *buildexpression.BuildExpression } diff --git a/pkg/platform/runtime/buildexpression/buildexpression.go b/pkg/platform/runtime/buildexpression/buildexpression.go index aa453a9b1a..64a2e88886 100644 --- a/pkg/platform/runtime/buildexpression/buildexpression.go +++ b/pkg/platform/runtime/buildexpression/buildexpression.go @@ -872,7 +872,7 @@ func (e *BuildExpression) removePlatform(platformID strfmt.UUID) error { return nil } -func (e *BuildExpression) UpdateTimestamp(timestamp time.Time) error { +func (e *BuildExpression) UpdateTimestamp(timestamp strfmt.DateTime) error { formatted, err := time.Parse(time.RFC3339, timestamp.String()) if err != nil { return errs.Wrap(err, "Could not parse latest timestamp")