Skip to content

Commit

Permalink
cleanup some code
Browse files Browse the repository at this point in the history
  • Loading branch information
mfleader committed Dec 4, 2023
1 parent 244b2ee commit 20b0c9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
8 changes: 3 additions & 5 deletions workflow/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (e *executor) Prepare(workflow *Workflow, workflowContext map[string][]byte
return nil, err
}

dataModel, err := getDatModel(runnableSteps, stepLifecycles)
dataModel, err := getStepDatModel(runnableSteps, stepLifecycles)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -397,16 +397,14 @@ func (e *executor) verifyStageInputs(
return nil
}

func getDatModel(
func getStepDatModel(
runnableSteps map[string]step.RunnableStep,
stepLifecycles map[string]step.Lifecycle[step.LifecycleStageWithSchema]) (map[string]any, error) {

Check failure on line 402 in workflow/executor.go

View workflow job for this annotation

GitHub Actions / golangci-lint

getStepDatModel - result 1 (error) is always nil (unparam)

var i interface{}
dataModel := map[string]any{
WorkflowInputKey: i,
WorkflowInputKey: nil,
WorkflowStepsKey: map[string]any{}}
for stepID, _ := range runnableSteps {

Check failure on line 407 in workflow/executor.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofmt`-ed with `-s` (gofmt)
//stepID := stepID
stepDataModel := map[string]any{}
for _, stage := range stepLifecycles[stepID].Stages {
steps := dataModel[WorkflowStepsKey].(map[string]any)
Expand Down
8 changes: 2 additions & 6 deletions workflow/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ steps:
wait_time_ms: 0
# invalid wait for specification
# specifically, deploy does not have any outputs
wait_for: !expr $.steps.wait_1.deploy
wait_for: !expr $.steps.wait_1.starting
outputs:
a:
b: !expr $.steps.wait_2.outputs
Expand All @@ -273,9 +273,5 @@ func TestDependOnNoOutputs(t *testing.T) {
// - wait_1 = {}; not having a property named 'deploy',
// - wait_1 = { deploy: nil }; the 'deploy' property has no outputs (i.e. nil output)
_, err := getTestImplPreparedWorkflow(t, invalidWaitfor)
assert.NoError(t, err)
//outputID, outputData, err := wf.Execute(context.Background(), map[any]any{})
//assert.Error(t, err)
//fmt.Printf("output id: %s\noutput: %v\n", outputID, outputData)
//assert.Contains(t, err.Error(), "object wait_1 does not have a property named deploy")
assert.Error(t, err)
}

0 comments on commit 20b0c9a

Please sign in to comment.