server/pkg/loafer/app/app.go

22 lines
446 B
Go
Raw Normal View History

2019-11-11 15:00:04 +00:00
package app
import (
"log"
"reflect"
cdr "git.loafle.net/commons/di-go/registry"
annotation "git.loafle.net/totopia/server/pkg/loafer/app/annotation"
)
func Run(t reflect.Type) {
ta := cdr.GetTypeAnnotation(t, annotation.ServerAnnotationType)
if nil == ta {
log.Printf("[%s] is not Server, use @app:Server", t.Elem().Name())
return
}
vta := ta.(*annotation.ServerAnnotation)
log.Printf("%s %d", t.Elem().Name(), vta.HTTPPort)
}