func main() { flag.Parse() log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds | log.Lshortfile) analyzers := []api.Analyzer{ new(postmessage.PostMessageAnalyzer), new(wordcount.WordCountAnalyzer), new(jshint.JSHintAnalyzer), new(codealert.CodeAlertAnalyzer), new(pylint.PyLintAnalyzer), new(govet.GoVetAnalyzer), } analyzerService := api.CreateAnalyzerService(analyzers, ctxpb.Stage_PRE_BUILD) s1 := server.Service{Name: "AnalyzerService"} if err := s1.Register(analyzerService); err != nil { log.Fatalf("Registering analyzer service failed: %v", err) } addr := fmt.Sprintf(":%d", *servicePort) log.Printf("-- Starting server endpoint at %q", addr) http.Handle("/", server.Endpoint{&s1}) if err := http.ListenAndServe(addr, nil); err != nil { log.Fatalf("Server startup failed: %v", err) } }
func main() { flag.Parse() // The shipshape service will connect to an AnalyzerService // at port 10005 in the container. (The service will map this to a different external // port at startup so that it doesn't clash with other analyzers.) s := server.Service{Name: "AnalyzerService"} as := api.CreateAnalyzerService([]api.Analyzer{new(androidlint.Analyzer)}, ctxpb.Stage_PRE_BUILD) if err := s.Register(as); err != nil { log.Fatalf("Registering analyzer service failed: %v", err) } addr := fmt.Sprintf(":%d", *servicePort) fmt.Fprintf(os.Stderr, "-- Starting server endpoint at %q\n", addr) http.Handle("/", server.Endpoint{&s}) if err := http.ListenAndServe(addr, nil); err != nil { log.Fatalf("Server startup failed: %v", err) } }