Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: auto code route format when addFunc in plugin #1861

Closed
wants to merge 1 commit into from

Conversation

clh021
Copy link
Contributor

@clh021 clh021 commented Aug 23, 2024

解决问题: "增加方法"时router module 的 Init 代码片段不在一行的语法风格问题。

修改前,"增加方法"时,生成的路由代码是这样的:

diff --git a/server/plugin/confmanage/router/confmanage_list.go b/server/plugin/confmanage/router/confmanage_list.go
index d92d7ab..ced5d2b 100644
--- a/server/plugin/confmanage/router/confmanage_list.go
+++ b/server/plugin/confmanage/router/confmanage_list.go
@@ -23,6 +23,10 @@ func (r *confmanageList) Init(public *gin.RouterGroup, private *gin.RouterGroup)
                group.GET("getConfmanageListList", apiConfmanageList.GetConfmanageListList)
                group.GET("getConfig", apiConfmanageList.GetConfig)
                group.POST("setConfig", apiConfmanageList.SetConfig)
+               group.GET("getConfig",
+
+                       apiConfmanageList.
+                               GetConfig)
 
        }
 }

修改后,生成的路由代码是这样的:

diff --git a/server/plugin/confmanage/router/confmanage_list.go b/server/plugin/confmanage/router/confmanage_list.go
index d92d7ab..c00d606 100644
--- a/server/plugin/confmanage/router/confmanage_list.go
+++ b/server/plugin/confmanage/router/confmanage_list.go
@@ -23,6 +23,7 @@ func (r *confmanageList) Init(public *gin.RouterGroup, private *gin.RouterGroup)
                group.GET("getConfmanageListList", apiConfmanageList.GetConfmanageListList)
                group.GET("getConfig", apiConfmanageList.GetConfig)
                group.POST("setConfig", apiConfmanageList.SetConfig)
+               group.GET("getConfig", apiConfmanageList.GetConfig)
 
        }
 }

@pixelmaxQm
Copy link
Collaborator

已合作修改为ast方式,目前代码已提交至dev273,感谢!

@pixelmaxQm pixelmaxQm closed this Aug 24, 2024
@clh021
Copy link
Contributor Author

clh021 commented Aug 24, 2024

a9076d7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants