func (cp *CodePasteChecker) Start() error { cp.Logger.Println("Starting CodePasteChecker") if cp.bot.config.CompileServer != "" { cs, err := lotsawa.NewCompileServiceStub("tcp", cp.bot.config.CompileServer) if err != nil { cp.bot.Logger.Println("Failed to dial rpc server:", err) cp.cs = nil } else { cp.cs = cs cp.bot.RegisterEventHandler(MessageParseEvent, cp.handleMessage) } } cp.State = Running return nil }
func main() { // Synchronous call var err error var s *lotsawa.CompileServiceStub s, err = lotsawa.NewCompileServiceStub("tcp", addr) if err != nil { fmt.Println("Failed to dial rpc server:", err) return } var arg lotsawa.CompileArgs = lotsawa.CompileArgs{"abc", "c"} var res lotsawa.CompileReply err = s.Compile(&arg, &res) if err != nil { fmt.Println("Failed to call rpc service:", err) return } fmt.Println(res) }