Skip to content

Commit

Permalink
Refactor spec.go to remove UnmarshalYAML boilerplate (#161)
Browse files Browse the repository at this point in the history
Before this, each UnmarshalYAML function was a copy-pasted block of
20-ish lines of boilerplate. With this change, each UnmarshalYAML
function turns into a one-liner which calls unmarshalPlain.

This requires a somewhat regrettable amount of reflection code, but it's
arguably no more confusing than what was there before, while having the
benefit of being more concise and DRY.

Fixes #30.

I'm attempting to use stacked PRs here; I intend to switch the base
branch of this PR to `main` once the `drevell/for-each-values-from`
branch is merged.
  • Loading branch information
drevell committed Aug 24, 2023
1 parent 6b93ede commit 7038f46
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 228 deletions.
2 changes: 1 addition & 1 deletion templates/commands/render_action_include.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func actionInclude(ctx context.Context, inc *model.Include, sp *stepParams) erro
return err
}

walkRelPath, err = safeRelPath(inc.Pos, walkRelPath)
walkRelPath, err = safeRelPath(&inc.Pos, walkRelPath)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit 7038f46

Please sign in to comment.