You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 19, 2023. It is now read-only.
Sometimes, out of laziness, I threw it in the package itself. We have a few options:
Add a Handler to every package which has all the fields necessary. Put all the actual event handlers on this object so it requires instantiation in order to use it
package chlog
// Just a default handlervarDefaultHandler=&Handler{} // modify me!// then pull it into the hook handlerpackage main
funcnewJekyllHandler() *hooks.GlobalHandler {
chlog.DefaultHandler.AddRepo("jekyll/jekyll") // or whatever, but key is you modify this package-wide handlerreturn&hooks.GlobalHandler{
Context: newContext(),
EventHandlers: map[hooks.EventType][]hooks.EventHandler{
hooks.CreateEvent: {chlog.DefaultHandler.CreateReleaseOnTagHandler},
},
}
}
Do an exported variable that is an instance of the baseline Handler. The importing main package then just uses this
funcnewJekyllHandler() *hooks.GlobalHandler {
chlogHandler:=chlog.NewHandler()
chlogHandler.AddRepo("jekyll/jekyll") // or whatever, but key is you make the handlerreturn&hooks.GlobalHandler{
Context: newContext(),
EventHandlers: map[hooks.EventType][]hooks.EventHandler{
hooks.CreateEvent: {chlogHandler.CreateReleaseOnTagHandler},
},
}
}
Do configuration in JSON or something that offers us configuration of the handlers on a per-repo basis, like
{
"jekyll/jekyll": {
"lgtm": { "quorum": 2 },
"affinity": {},
},
"jekyll/jekyll-help" : {
"deprecate": {
"message": "Hey! Thanks for your issue. We have moved..."
}
},
}
Then each package's Handler would be unmarshalled into a Go object and given the JSON values in the config.
Sometimes, out of laziness, I threw it in the package itself. We have a few options:
Handlerto every package which has all the fields necessary. Put all the actual event handlers on this object so it requires instantiation in order to use itHandler. The importingmainpackage then just uses this{ "jekyll/jekyll": { "lgtm": { "quorum": 2 }, "affinity": {}, }, "jekyll/jekyll-help" : { "deprecate": { "message": "Hey! Thanks for your issue. We have moved..." } }, }Then each package's
Handlerwould be unmarshalled into a Go object and given the JSON values in the config.Which which which?