Example #1
0
func stringerCompile(root, stringer, stringersrc string) {
	//	stringersrc := filepath.Join(root, "golang.org/x/tools/cmd/stringer/stringer.go")
	err := run("go", "build", "-o", stringer, stringersrc)
	if err != nil {
		log.Fatalf("building stringer: %s", err)
	}
}
Example #2
0
func main() {
	//register rpc
	models := dao.NewModels()
	rpc.Register(models.User)
	rpc.Register(models.Game)
	defer func() {
		models.Exit()
	}()

	//network
	serverAddr := "127.0.0.1:" + cfg.DaoPort
	l, e := net.Listen("tcp", serverAddr) // any available address
	if e != nil {
		log.Fatalf("net.Listen tcp : %v", e)
	}
	log.Info("dao RPC server listening on ", serverAddr)
	rpc.Accept(l)
}