This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 66e4f6363 fix: PluginInit should be implemented on struct (#6325)
66e4f6363 is described below
commit 66e4f6363006967e69941f1cf8f765c5c0c17467
Author: Klesh Wong <[email protected]>
AuthorDate: Wed Oct 25 15:24:48 2023 +0800
fix: PluginInit should be implemented on struct (#6325)
---
backend/plugins/customize/impl/impl.go | 21 +++++++++++----------
backend/plugins/jira/impl/impl.go | 2 +-
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/backend/plugins/customize/impl/impl.go
b/backend/plugins/customize/impl/impl.go
index b75fed4e1..facb0515d 100644
--- a/backend/plugins/customize/impl/impl.go
+++ b/backend/plugins/customize/impl/impl.go
@@ -37,12 +37,13 @@ var _ interface {
plugin.PluginMigration
} = (*Customize)(nil)
+var handlers *api.Handlers
+
type Customize struct {
- handlers *api.Handlers
}
-func (p *Customize) Init(basicRes context.BasicRes) errors.Error {
- p.handlers = api.NewHandlers(basicRes.GetDal())
+func (p Customize) Init(basicRes context.BasicRes) errors.Error {
+ handlers = api.NewHandlers(basicRes.GetDal())
return nil
}
@@ -89,23 +90,23 @@ func (p Customize) RootPkgPath() string {
return "github.com/apache/incubator-devlake/plugins/customize"
}
-func (p *Customize) ApiResources()
map[string]map[string]plugin.ApiResourceHandler {
+func (p Customize) ApiResources()
map[string]map[string]plugin.ApiResourceHandler {
return map[string]map[string]plugin.ApiResourceHandler{
":table/fields": {
- "GET": p.handlers.ListFields,
- "POST": p.handlers.CreateFields,
+ "GET": handlers.ListFields,
+ "POST": handlers.CreateFields,
},
":table/fields/:field": {
- "DELETE": p.handlers.DeleteField,
+ "DELETE": handlers.DeleteField,
},
"csvfiles/issues.csv": {
- "POST": p.handlers.ImportIssue,
+ "POST": handlers.ImportIssue,
},
"csvfiles/issue_commits.csv": {
- "POST": p.handlers.ImportIssueCommit,
+ "POST": handlers.ImportIssueCommit,
},
"csvfiles/issue_repo_commits.csv": {
- "POST": p.handlers.ImportIssueRepoCommit,
+ "POST": handlers.ImportIssueRepoCommit,
},
}
}
diff --git a/backend/plugins/jira/impl/impl.go
b/backend/plugins/jira/impl/impl.go
index 62c8f5cc7..d95587c3f 100644
--- a/backend/plugins/jira/impl/impl.go
+++ b/backend/plugins/jira/impl/impl.go
@@ -60,7 +60,7 @@ func (p Jira) ScopeConfig() dal.Tabler {
return &models.JiraScopeConfig{}
}
-func (p *Jira) Init(basicRes context.BasicRes) errors.Error {
+func (p Jira) Init(basicRes context.BasicRes) errors.Error {
api.Init(basicRes, p)
return nil