-
Notifications
You must be signed in to change notification settings - Fork 2
/
function.go
73 lines (59 loc) · 1.79 KB
/
function.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// nolint
package archunit
import (
"fmt"
"github.com/kcmvp/archunit/internal"
"github.com/samber/lo"
)
type Functions []internal.Function
func FunctionsOfType(fTypName string) (Functions, error) {
typ, ok := internal.Arch().Type(fTypName)
if !ok || !typ.FuncType() {
return Functions{}, fmt.Errorf("can not find function type %s", fTypName)
}
lo.ForEach(lo.Filter(internal.Arch().Packages(), func(pkg *internal.Package, _ int) bool {
return lo.Contains(pkg.Imports(), typ.Package())
}), func(pkg *internal.Package, _ int) {
panic("should not reach here")
})
//for _, pkg := range internal.Arch().packages() {
// if strings.HasSuffix(pkg.ID(), "github.com/kcmvp/archunit/internal/sample/service") {
// for _, f := range pkg.RawFunctions() {
// if types.Identical(typ.TypeValue().Underlying(), f.Type()) {
// println(f.FullName())
// }
// }
// }
//}
return Functions{}, nil
}
func (functions Functions) Exclude(names ...string) Functions {
panic("to be implemented")
}
func (functions Functions) InPackage(paths ...string) Functions {
panic("to be implemented")
}
func (functions Functions) OfType(types ...string) Functions {
panic("to be implemented")
}
func (functions Functions) WithReturn() Functions {
panic("to be implemented")
}
func (functions Functions) WithParameter() Functions {
panic("to be implemented")
}
func (functions Functions) ShouldBeInPackage(pkgPath ...string) error {
panic("to be implemented")
}
func (functions Functions) ShouldBe(visibility Visible) error {
panic("to be implemented")
}
func (functions Functions) LineOfCodeLessThan(n int) error {
panic("to be implemented")
}
func (functions Functions) NameShould(pattern NamePattern) error {
panic("to be implemented")
}
func (functions Functions) NoAnonymous() error {
panic("to be implemented")
}