mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 13:10:24 +08:00 
			
		
		
		
	优化代码
This commit is contained in:
		
							
								
								
									
										6115
									
								
								build/rpc.json
									
									
									
									
									
								
							
							
						
						
									
										6115
									
								
								build/rpc.json
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -10,7 +10,7 @@ import (
 | 
				
			|||||||
	"github.com/iwind/TeaGo/Tea"
 | 
						"github.com/iwind/TeaGo/Tea"
 | 
				
			||||||
	_ "github.com/iwind/TeaGo/bootstrap"
 | 
						_ "github.com/iwind/TeaGo/bootstrap"
 | 
				
			||||||
	"github.com/iwind/TeaGo/types"
 | 
						"github.com/iwind/TeaGo/types"
 | 
				
			||||||
	"io/ioutil"
 | 
						"os"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
	"regexp"
 | 
						"regexp"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
@@ -91,7 +91,12 @@ func main() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				for _, path := range files {
 | 
									for _, path := range files {
 | 
				
			||||||
					func(path string) {
 | 
										func(path string) {
 | 
				
			||||||
						data, err := ioutil.ReadFile(path)
 | 
											var filename = filepath.Base(path)
 | 
				
			||||||
 | 
											if filename == "service_authority_key.proto" || filename == "service_authority_node.proto" {
 | 
				
			||||||
 | 
												return
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											data, err := os.ReadFile(path)
 | 
				
			||||||
						if err != nil {
 | 
											if err != nil {
 | 
				
			||||||
							fmt.Println("[ERROR]" + err.Error())
 | 
												fmt.Println("[ERROR]" + err.Error())
 | 
				
			||||||
							return
 | 
												return
 | 
				
			||||||
@@ -142,7 +147,7 @@ func main() {
 | 
				
			|||||||
							services = append(services, &ServiceInfo{
 | 
												services = append(services, &ServiceInfo{
 | 
				
			||||||
								Name:     serviceName,
 | 
													Name:     serviceName,
 | 
				
			||||||
								Methods:  methods,
 | 
													Methods:  methods,
 | 
				
			||||||
								Filename: filepath.Base(path),
 | 
													Filename: filename,
 | 
				
			||||||
								Doc:      comment,
 | 
													Doc:      comment,
 | 
				
			||||||
							})
 | 
												})
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
@@ -231,7 +236,7 @@ func main() {
 | 
				
			|||||||
				for _, path := range files {
 | 
									for _, path := range files {
 | 
				
			||||||
					func(path string) {
 | 
										func(path string) {
 | 
				
			||||||
						var name = strings.TrimSuffix(filepath.Base(path), ".md")
 | 
											var name = strings.TrimSuffix(filepath.Base(path), ".md")
 | 
				
			||||||
						data, err := ioutil.ReadFile(path)
 | 
											data, err := os.ReadFile(path)
 | 
				
			||||||
						if err != nil {
 | 
											if err != nil {
 | 
				
			||||||
							fmt.Println("[ERROR]read '" + path + "' failed: " + err.Error())
 | 
												fmt.Println("[ERROR]read '" + path + "' failed: " + err.Error())
 | 
				
			||||||
							return
 | 
												return
 | 
				
			||||||
@@ -259,7 +264,7 @@ func main() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var jsonFile = Tea.Root + "/rpc.json"
 | 
						var jsonFile = Tea.Root + "/rpc.json"
 | 
				
			||||||
	err = ioutil.WriteFile(jsonFile, jsonData, 0666)
 | 
						err = os.WriteFile(jsonFile, jsonData, 0666)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		fmt.Println("[ERROR]write json to file failed: " + err.Error())
 | 
							fmt.Println("[ERROR]write json to file failed: " + err.Error())
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user