Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredoconnell committed Sep 9, 2024
1 parent de80c54 commit 1aca9a6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions internal/infer/infer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var testData = []testEntry{
"foo",
nil,
schema.TypeIDString,
func(t schema.Type) error {
func(_ schema.Type) error {
return nil
},
},
Expand Down Expand Up @@ -93,7 +93,7 @@ var testData = []testEntry{
}),
),
schema.TypeIDString,
func(t schema.Type) error {
func(_ schema.Type) error {
return nil
},
},
Expand Down
3 changes: 3 additions & 0 deletions workflow/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,9 @@ func (e *executor) prepareDependencies( //nolint:gocognit,gocyclo
return err
}
err = currentNode.ConnectDependency(oneofDagNode.ID(), dgraph.AndDependency)
if err != nil {
return err
}
// Mark the node ID on the OneOfExpression
s.Node = oneofDagNode.ID()
for optionID, optionData := range s.Options {
Expand Down
11 changes: 5 additions & 6 deletions workflow/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (e *executableWorkflow) Execute(ctx context.Context, serializedInput any) (

var stageHandler step.StageChangeHandler = &stageChangeHandler{
onStageChange: func(
step step.RunningStep,
_ step.RunningStep,
previousStage *string,
previousStageOutputID *string,
previousStageOutput *any,
Expand All @@ -148,7 +148,7 @@ func (e *executableWorkflow) Execute(ctx context.Context, serializedInput any) (
l.onStageComplete(stepID, previousStage, previousStageOutputID, previousStageOutput, wg)
},
onStepComplete: func(
step step.RunningStep,
_ step.RunningStep,
previousStage string,
previousStageOutputID *string,
previousStageOutput *any,
Expand All @@ -161,7 +161,7 @@ func (e *executableWorkflow) Execute(ctx context.Context, serializedInput any) (
}
l.onStageComplete(stepID, &previousStage, previousStageOutputID, previousStageOutput, wg)
},
onStepStageFailure: func(step step.RunningStep, stage string, wg *sync.WaitGroup, err error) {
onStepStageFailure: func(_ step.RunningStep, stage string, _ *sync.WaitGroup, err error) {
if err == nil {
e.logger.Debugf("Step %q stage %q declared that it will not produce an output", stepID, stage)
} else {
Expand Down Expand Up @@ -698,11 +698,10 @@ func (l *loopState) resolveExpressions(inputData any, dataModel any) (any, error
dependencies := oneOfNode.ResolvedDependencies()
firstResolvedDependency := ""
for dependency, dependencyType := range dependencies {
switch dependencyType {
case dgraph.OrDependency:
if dependencyType == dgraph.OrDependency {
firstResolvedDependency = dependency
break
case dgraph.ObviatedDependency:
} else if dependencyType == dgraph.ObviatedDependency {
l.logger.Infof("Multiple OR cases triggered; skipping %q", dependency)
}
}
Expand Down
7 changes: 6 additions & 1 deletion workflow/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ func (y yamlConverter) FromYAML(data []byte) (*Workflow, error) {
return workflow, nil
}

// YamlOneOfKey is the key to specify the oneof options within a !oneof section.
const YamlOneOfKey = "one_of"

// YamlDiscriminatorKey is the key to specify the discriminator inside a !oneof section.
const YamlDiscriminatorKey = "discriminator"

// YamlOneOfTag is the yaml tag that allows the section to be interpreted as a OneOf.
const YamlOneOfTag = "!oneof"

func buildOneOfExpressions(data yaml.Node, path []string) (any, error) {
Expand All @@ -76,7 +81,7 @@ func buildOneOfExpressions(data yaml.Node, path []string) (any, error) {
for _, optionNodeKey := range oneOfOptionsNode.MapKeys() {
optionNode, _ := oneOfOptionsNode.MapKey(optionNodeKey)
var err error
options[optionNodeKey], err = yamlBuildExpressions(optionNode, append(path))
options[optionNodeKey], err = yamlBuildExpressions(optionNode, append(path, optionNodeKey))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 1aca9a6

Please sign in to comment.