func check(files []string) { logFile, err := RootCmd.PersistentFlags().GetString("log") if err != nil { log.Fatal(err) } noLogging, err := RootCmd.PersistentFlags().GetBool("no-logging") if err != nil { log.Fatal(err) } noColour, err := RootCmd.PersistentFlags().GetBool("no-colour") if err != nil { log.Fatal(err) } l := logwriter.NewFile(logFile, !noLogging, !noColour) if err := l.Create(); err != nil { log.Fatal(err) } defer l.Cleanup() conf, err := ssabuilder.NewConfig(files) if err != nil { log.Fatal(err) } conf.BuildLog = l.Writer ssainfo, err := conf.Build() if err != nil { log.Fatal(err) } fairness.Check(ssainfo) }
func extractMigo(files []string) { logFile, err := RootCmd.PersistentFlags().GetString("log") if err != nil { log.Fatal(err) } noLogging, err := RootCmd.PersistentFlags().GetBool("no-logging") if err != nil { log.Fatal(err) } noColour, err := RootCmd.PersistentFlags().GetBool("no-colour") if err != nil { log.Fatal(err) } l := logwriter.NewFile(logFile, !noLogging, !noColour) if err := l.Create(); err != nil { log.Fatal(err) } defer l.Cleanup() conf, err := ssabuilder.NewConfig(files) if err != nil { log.Fatal(err) } conf.BuildLog = l.Writer ssainfo, err := conf.Build() if err != nil { log.Fatal(err) } extract, err := migoextract.New(ssainfo, l.Writer) if err != nil { log.Fatal(err) } go extract.Run() select { case <-extract.Error: log.Fatal(err) case <-extract.Done: extract.Logger.Println("Analysis finished in", extract.Time) } extract.Env.MigoProg.CleanUp() if outfile != "" { f, err := os.Create(outfile) if err != nil { log.Fatal(err) } f.WriteString(extract.Env.MigoProg.String()) defer f.Close() } else { os.Stdout.WriteString(extract.Env.MigoProg.String()) } }
func extractCFSMs(files []string) { logFile, err := RootCmd.PersistentFlags().GetString("log") if err != nil { log.Fatal(err) } noLogging, err := RootCmd.PersistentFlags().GetBool("no-logging") if err != nil { log.Fatal(err) } noColour, err := RootCmd.PersistentFlags().GetBool("no-colour") if err != nil { log.Fatal(err) } l := logwriter.NewFile(logFile, !noLogging, !noColour) if err := l.Create(); err != nil { log.Fatal(err) } defer l.Cleanup() conf, err := ssabuilder.NewConfig(files) conf.BuildLog = l.Writer if err != nil { log.Fatal(err) } ssainfo, err := conf.Build() if err != nil { log.Fatal(err) } extract := cfsmextract.New(ssainfo, prefix, outdir) go extract.Run() select { case <-extract.Error: log.Fatal(err) case <-extract.Done: log.Println("Analysis finished in", extract.Time) extract.WriteOutput() } }
func Build(files []string) { logFile, err := RootCmd.PersistentFlags().GetString("log") if err != nil { log.Fatal(err) } noLogging, err := RootCmd.PersistentFlags().GetBool("no-logging") if err != nil { log.Fatal(err) } noColour, err := RootCmd.PersistentFlags().GetBool("no-colour") if err != nil { log.Fatal(err) } l := logwriter.NewFile(logFile, !noLogging, !noColour) if err := l.Create(); err != nil { log.Fatal(err) } defer l.Cleanup() conf, err := ssabuilder.NewConfig(files) if err != nil { log.Fatal(err) } conf.BuildLog = l.Writer ssainfo, err := conf.Build() if err != nil { log.Fatal(err) } if dumpSSA { if _, err := ssainfo.WriteTo(os.Stdout); err != nil { log.Fatal(err) } } if dumpAll { if _, err := ssainfo.WriteAll(os.Stdout); err != nil { log.Fatal(err) } } }