add some routes
This commit is contained in:
19
gen/gen.go
19
gen/gen.go
@@ -24,18 +24,23 @@ func main() {
|
||||
moduleName := "bdgrp_go"
|
||||
|
||||
filepath.WalkDir("routes", func(path string, d os.DirEntry, err error) error {
|
||||
if err != nil || !d.IsDir() || path == "routes" {
|
||||
if err != nil || d.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
entries, _ := os.ReadDir(path)
|
||||
for _, e := range entries {
|
||||
if !e.IsDir() && strings.HasSuffix(e.Name(), ".go") {
|
||||
pkg := moduleName + "/" + filepath.ToSlash(path)
|
||||
packages = append(packages, pkg)
|
||||
break
|
||||
if !strings.HasSuffix(d.Name(), ".go") {
|
||||
return nil
|
||||
}
|
||||
|
||||
pkg := moduleName + "/" + filepath.ToSlash(filepath.Dir(path))
|
||||
|
||||
for _, p := range packages {
|
||||
if p == pkg {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
packages = append(packages, pkg)
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user