Skip to content

Commit

Permalink
lang: Unnested the core package from the functions dir
Browse files Browse the repository at this point in the history
The core package could contain non-functions, so we might as well move
it upwards.
  • Loading branch information
purpleidea committed Feb 22, 2024
1 parent 1c64536 commit 5a8310f
Show file tree
Hide file tree
Showing 94 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ clean: ## clean things up
$(MAKE) --quiet -C test clean
$(MAKE) --quiet -C lang clean
$(MAKE) --quiet -C misc/mkosi clean
rm -f lang/funcs/core/generated_funcs.go || true
rm -f lang/funcs/core/generated_funcs_test.go || true
rm -f lang/core/generated_funcs.go || true
rm -f lang/core/generated_funcs_test.go || true
[ ! -e $(PROGRAM) ] || rm $(PROGRAM)
rm -f *_stringer.go # generated by `go generate`
rm -f *_mock.go # generated by `go generate`
Expand Down Expand Up @@ -505,9 +505,9 @@ help: ## show this help screen
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
@echo ''

funcgen: lang/funcs/core/generated_funcs.go
funcgen: lang/core/generated_funcs.go

lang/funcs/core/generated_funcs.go: lang/funcs/funcgen/*.go lang/funcs/core/funcgen.yaml lang/funcs/funcgen/templates/generated_funcs.go.tpl
lang/core/generated_funcs.go: lang/funcs/funcgen/*.go lang/core/funcgen.yaml lang/funcs/funcgen/templates/generated_funcs.go.tpl
@echo "Generating: funcs..."
@go run `find lang/funcs/funcgen/ -maxdepth 1 -type f -name '*.go' -not -name '*_test.go'` -templates=lang/funcs/funcgen/templates/generated_funcs.go.tpl >/dev/null

Expand Down
2 changes: 1 addition & 1 deletion lang/ast/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

"github.com/purpleidea/mgmt/engine"
engineUtil "github.com/purpleidea/mgmt/engine/util"
"github.com/purpleidea/mgmt/lang/core"
"github.com/purpleidea/mgmt/lang/funcs"
"github.com/purpleidea/mgmt/lang/funcs/core"
"github.com/purpleidea/mgmt/lang/funcs/structs"
"github.com/purpleidea/mgmt/lang/inputs"
"github.com/purpleidea/mgmt/lang/interfaces"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 16 additions & 16 deletions lang/funcs/core/core.go → lang/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ import (
"io/fs"

// import so the funcs register
_ "github.com/purpleidea/mgmt/lang/funcs/core/convert"
_ "github.com/purpleidea/mgmt/lang/funcs/core/datetime"
_ "github.com/purpleidea/mgmt/lang/funcs/core/deploy"
_ "github.com/purpleidea/mgmt/lang/funcs/core/example"
_ "github.com/purpleidea/mgmt/lang/funcs/core/example/nested"
_ "github.com/purpleidea/mgmt/lang/funcs/core/fmt"
_ "github.com/purpleidea/mgmt/lang/funcs/core/iter"
_ "github.com/purpleidea/mgmt/lang/funcs/core/math"
_ "github.com/purpleidea/mgmt/lang/funcs/core/net"
_ "github.com/purpleidea/mgmt/lang/funcs/core/os"
_ "github.com/purpleidea/mgmt/lang/funcs/core/regexp"
_ "github.com/purpleidea/mgmt/lang/funcs/core/strings"
_ "github.com/purpleidea/mgmt/lang/funcs/core/sys"
_ "github.com/purpleidea/mgmt/lang/funcs/core/test"
_ "github.com/purpleidea/mgmt/lang/funcs/core/value"
_ "github.com/purpleidea/mgmt/lang/funcs/core/world"
_ "github.com/purpleidea/mgmt/lang/core/convert"
_ "github.com/purpleidea/mgmt/lang/core/datetime"
_ "github.com/purpleidea/mgmt/lang/core/deploy"
_ "github.com/purpleidea/mgmt/lang/core/example"
_ "github.com/purpleidea/mgmt/lang/core/example/nested"
_ "github.com/purpleidea/mgmt/lang/core/fmt"
_ "github.com/purpleidea/mgmt/lang/core/iter"
_ "github.com/purpleidea/mgmt/lang/core/math"
_ "github.com/purpleidea/mgmt/lang/core/net"
_ "github.com/purpleidea/mgmt/lang/core/os"
_ "github.com/purpleidea/mgmt/lang/core/regexp"
_ "github.com/purpleidea/mgmt/lang/core/strings"
_ "github.com/purpleidea/mgmt/lang/core/sys"
_ "github.com/purpleidea/mgmt/lang/core/test"
_ "github.com/purpleidea/mgmt/lang/core/value"
_ "github.com/purpleidea/mgmt/lang/core/world"
)

// TODO: Instead of doing this one-level embed, we could give each package an
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package corenested

import (
coreexample "github.com/purpleidea/mgmt/lang/funcs/core/example"
coreexample "github.com/purpleidea/mgmt/lang/core/example"
"github.com/purpleidea/mgmt/lang/funcs/simple"
"github.com/purpleidea/mgmt/lang/types"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lang/funcs/funcgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

var (
pkg = flag.String("package", "lang/funcs/core", "path to the package")
pkg = flag.String("package", "lang/core", "path to the package")
filename = flag.String("filename", "funcgen.yaml", "path to the config")
templates = flag.String("templates", "lang/funcs/funcgen/templates/*.tpl", "path to the templates")
)
Expand Down
2 changes: 1 addition & 1 deletion lang/lang.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/purpleidea/mgmt/engine"
"github.com/purpleidea/mgmt/engine/local"
"github.com/purpleidea/mgmt/lang/ast"
_ "github.com/purpleidea/mgmt/lang/funcs/core" // import so the funcs register
_ "github.com/purpleidea/mgmt/lang/core" // import so the funcs register
"github.com/purpleidea/mgmt/lang/funcs/dage"
"github.com/purpleidea/mgmt/lang/funcs/vars"
"github.com/purpleidea/mgmt/lang/inputs"
Expand Down
2 changes: 1 addition & 1 deletion lang/lang_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

"github.com/purpleidea/mgmt/engine"
"github.com/purpleidea/mgmt/engine/resources"
_ "github.com/purpleidea/mgmt/lang/funcs/core" // import so the funcs register
_ "github.com/purpleidea/mgmt/lang/core" // import so the funcs register
"github.com/purpleidea/mgmt/lang/inputs"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/pgraph"
Expand Down

0 comments on commit 5a8310f

Please sign in to comment.