Skip to content

Commit

Permalink
switch to using pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
hay-kot committed Nov 29, 2022
1 parent 27bd990 commit 8ef8a58
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion flint/builtins/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package builtins

import "github.com/hay-kot/flint/pkgs/frontmatter"

type CheckerFunc func(fm frontmatter.FrontMatter) error
type CheckerFunc func(fm *frontmatter.FrontMatter) error

type BuiltIns struct {
ID string
Expand Down
4 changes: 2 additions & 2 deletions flint/builtins/dateformat.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
)

func (b BuiltIns) DateFormatFunc(formats []string, fields []string) CheckerFunc {
return func(fm frontmatter.FrontMatter) error {
return func(fm *frontmatter.FrontMatter) error {
return b.DateFormat(fm, formats, fields)
}
}

func (b BuiltIns) DateFormat(fm frontmatter.FrontMatter, formats []string, fields []string) error {
func (b BuiltIns) DateFormat(fm *frontmatter.FrontMatter, formats []string, fields []string) error {
errGroup := ValueErrors{
ID: b.ID,
Level: b.Level,
Expand Down
4 changes: 2 additions & 2 deletions flint/builtins/enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
)

func (b BuiltIns) EnumFunc(values []string, fields []string) CheckerFunc {
return func(fm frontmatter.FrontMatter) error {
return func(fm *frontmatter.FrontMatter) error {
return b.DateFormat(fm, values, fields)
}
}

func (b BuiltIns) Enum(fm frontmatter.FrontMatter, values []string, fields []string) error {
func (b BuiltIns) Enum(fm *frontmatter.FrontMatter, values []string, fields []string) error {
valueErrors := ValueErrors{
ID: b.ID,
Level: b.Level,
Expand Down
2 changes: 1 addition & 1 deletion flint/builtins/length.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func (b *BuiltIns) LengthFunc(min, max int, fields []string) CheckerFunc {
return func(fm frontmatter.FrontMatter) error {
return func(fm *frontmatter.FrontMatter) error {
valueErrors := ValueErrors{
ID: b.ID,
Level: b.Level,
Expand Down
4 changes: 2 additions & 2 deletions flint/builtins/match.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ func (b BuiltIns) MatchFunc(patterns []string, fields []string) CheckerFunc {
compiled = append(compiled, regexp.MustCompile(r))
}

return func(fm frontmatter.FrontMatter) error {
return func(fm *frontmatter.FrontMatter) error {
return b.Match(fm, compiled, fields)
}
}

func (b BuiltIns) Match(fm frontmatter.FrontMatter, rgx []*regexp.Regexp, fields []string) error {
func (b BuiltIns) Match(fm *frontmatter.FrontMatter, rgx []*regexp.Regexp, fields []string) error {
errors := ValueErrors{
ID: b.ID,
Level: b.Level,
Expand Down
2 changes: 1 addition & 1 deletion flint/builtins/required.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func (b BuiltIns) RequiredFunc(required []string) CheckerFunc {
requiredSet := set.New(required...)

return func(fm frontmatter.FrontMatter) error {
return func(fm *frontmatter.FrontMatter) error {
fmKeys := set.New(fm.Keys()...)
missing := fmKeys.Missing(requiredSet)

Expand Down

0 comments on commit 8ef8a58

Please sign in to comment.