mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-04 21:50:26 +08:00
修复从API代码中提取角色时无法查找子目录的Bug
This commit is contained in:
7704
build/rpc.json
7704
build/rpc.json
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
_ "github.com/iwind/TeaGo/bootstrap"
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -96,6 +97,21 @@ func main() {
|
||||
var methodRolesMap = map[string][]string{} // method => roles
|
||||
{
|
||||
var rootDir = filepath.Clean(Tea.Root + "/../../EdgeAPI/internal/rpc/services")
|
||||
entries, err := os.ReadDir(rootDir)
|
||||
if err != nil {
|
||||
logs.Println("[ERROR]read api services from '" + rootDir + "' failed: " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
var rootDirs = []string{rootDir}
|
||||
|
||||
for _, entry := range entries {
|
||||
if entry.IsDir() {
|
||||
rootDirs = append(rootDirs, rootDir+string(os.PathSeparator)+entry.Name())
|
||||
}
|
||||
}
|
||||
|
||||
for _, rootDir := range rootDirs {
|
||||
files, err := filepath.Glob(rootDir + "/service_*.go")
|
||||
if err != nil {
|
||||
fmt.Println("[ERROR]list service implementation files failed: " + err.Error())
|
||||
@@ -178,6 +194,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var services = []*ServiceInfo{}
|
||||
var messages = []*MessageInfo{}
|
||||
|
||||
Reference in New Issue
Block a user