-
Notifications
You must be signed in to change notification settings - Fork 4
/
cast.go
30 lines (26 loc) · 844 Bytes
/
cast.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package modules
import (
"github.com/salsaflow/salsaflow/config/loader"
"github.com/salsaflow/salsaflow/modules/common"
)
func AsIssueTrackingModule(module loader.Module) (common.IssueTrackingModule, error) {
mod, ok := module.(common.IssueTrackingModule)
if !ok {
return nil, &ErrInvalidModule{module.Id(), loader.ModuleKindIssueTracking}
}
return mod, nil
}
func AsCodeReviewModule(module loader.Module) (common.CodeReviewModule, error) {
mod, ok := module.(common.CodeReviewModule)
if !ok {
return nil, &ErrInvalidModule{module.Id(), loader.ModuleKindCodeReview}
}
return mod, nil
}
func AsReleaseNotesModule(module loader.Module) (common.ReleaseNotesModule, error) {
mod, ok := module.(common.ReleaseNotesModule)
if !ok {
return nil, &ErrInvalidModule{module.Id(), loader.ModuleKindReleaseNotes}
}
return mod, nil
}