forked from AOEpeople/vistecture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnalyzeController.go
39 lines (32 loc) · 967 Bytes
/
AnalyzeController.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
31
32
33
34
35
36
37
38
39
package controller
import (
"fmt"
"log"
"github.com/AOEpeople/vistecture/model/analyze"
"github.com/AOEpeople/vistecture/model/core"
)
type AnalyzeController struct {
project *core.Project
}
func (a *AnalyzeController) Inject(project *core.Project) {
a.project = project
}
func (a *AnalyzeController) AnalyzeAction() {
var ProjectAnalyzer analyze.ProjectAnalyzer
errors := ProjectAnalyzer.AnalyzeCyclicDependencies(a.project)
if errors != nil {
for _, error := range errors {
fmt.Println(error)
}
log.Fatal("Solve Errors please!")
}
fmt.Println("\nGreat - no errors or cyclic dependencies found in your definitions!")
fmt.Println()
fmt.Println("Impact Analysis: \n(How many other components may be influenced if a component fails)")
impacts := ProjectAnalyzer.ImpactAnalyze(a.project)
fmt.Println("Direct\t\tIndirect\tComponent")
fmt.Println("------\t\t--------\t--------")
for _, impact := range impacts {
fmt.Println(impact)
}
}