This commit is contained in:
Mike Schwörer 2023-06-07 12:45:48 +02:00
parent 8affa81bb9
commit d0954bf133
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
3 changed files with 21 additions and 12 deletions

View File

@ -55,12 +55,13 @@ func GenerateEnumSpecs(sourceDir string, destFile string) error {
} }
} }
langext.ArrFilter(files, func(v os.DirEntry) bool { return v.Name() != path.Base(destFile) }) files = langext.ArrFilter(files, func(v os.DirEntry) bool { return v.Name() != path.Base(destFile) })
files = langext.ArrFilter(files, func(v os.DirEntry) bool { return strings.HasSuffix(v.Name(), ".go") })
langext.SortBy(files, func(v os.DirEntry) string { return v.Name() }) langext.SortBy(files, func(v os.DirEntry) string { return v.Name() })
newChecksumStr := goext.GoextVersion newChecksumStr := goext.GoextVersion
for _, f := range files { for _, f := range files {
content, err := os.ReadFile(destFile) content, err := os.ReadFile(path.Join(sourceDir, f.Name()))
if err != nil { if err != nil {
return err return err
} }
@ -81,15 +82,8 @@ func GenerateEnumSpecs(sourceDir string, destFile string) error {
pkgname := "" pkgname := ""
for _, f := range files { for _, f := range files {
if !strings.HasSuffix(f.Name(), ".go") {
continue
}
if f.Name() == path.Base(destFile) {
continue
}
fmt.Printf("========= %s =========\n\n", f.Name()) fmt.Printf("========= %s =========\n\n", f.Name())
fileEnums, pn, err := processFile(f.Name()) fileEnums, pn, err := processFile(path.Join(sourceDir, f.Name()))
if err != nil { if err != nil {
return err return err
} }

View File

@ -0,0 +1,15 @@
package bfcodegen
import (
"testing"
)
func TestApplyEnvOverridesSimple(t *testing.T) {
err := GenerateEnumSpecs("/home/mike/Code/reiff/badennet/bnet-backend/models", "/home/mike/Code/reiff/badennet/bnet-backend/models/enums_gen.go")
if err != nil {
t.Error(err)
t.Fail()
}
}

View File

@ -1,5 +1,5 @@
package goext package goext
const GoextVersion = "0.0.144" const GoextVersion = "0.0.145"
const GoextVersionTimestamp = "2023-06-07T12:39:21+0200" const GoextVersionTimestamp = "2023-06-07T12:45:48+0200"