Loom - A repository for Weave Files
Used by GoWeave
A weave file contains aspects to weave into projects.
The weave file is subject to dramatic change right now. There is no formal specification as of yet.
##Hello World Weave File:##
aspect {
imports (
"fmt"
)
pointcut: execute(*)
advice: {
before: {
fmt.Println("hi")
}
}
}
Loom has a listing of samples and user-contributed weaves you might wish to look at or utilize.
Essentially we support aspect files w/in a project. If code exists in your project we should be able to provide aspect coverage for it.
There are a few design decisions that need to be made to support across projects && into stdlib. Stdlib probably won't come until we move to IR.
To try things out first try running go build
. Then try running goweave
.
aspect {
pointcut: execute(beforeBob())
advice: {
before: {
fmt.Println("before bob")
}
}
}
aspect {
pointcut: execute(afterAnnie())
advice: {
after: {
fmt.Println("after annie")
}
}
}
aspect {
pointcut: execute(main())
advice: {
before: {
fmt.Println("hello world")
}
}
}
aspect {
pointcut: execute(*)
advice: {
before: {
var globalCntr int = 0
}
}
}
aspect {
pointcut: call(beforeBob())
advice: {
before: {
fmt.Println("before bob")
}
}
}
aspect {
pointcut: call(afterAnnie())
advice: {
after: {
fmt.Println("after annie")
}
}
}
aspect {
pointcut: call(http.HandleFunc(d, s))
advice: {
around: {
http.HandleFunc(d, dps.HTTPHandlerFunc(s))
}
}
}