我也很纳闷源码为啥不能运行,难道仓库管理员没检查?
把main.go变成下面的
func main() { p := &program{} //if err := svc.Run(prg, syscall.SIGINT, syscall.SIGTERM); err != nil { // logFatal("%s", err) //} opts := nsqd.NewOptions() flagSet := nsqdFlagSet(opts) flagSet.Parse(os.Args[1:]) rand.Seed(time.Now().UTC().UnixNano()) if flagSet.Lookup("version").Value.(flag.Getter).Get().(bool) { fmt.Println(version.String("nsqd")) os.Exit(0) } var cfg config configFile := flagSet.Lookup("config").Value.String() if configFile != "" { _, err := toml.DecodeFile(configFile, &cfg) if err != nil { logFatal("failed to load config file %s - %s", configFile, err) } } cfg.Validate() options.Resolve(opts, flagSet, cfg) nsqd, err := nsqd.New(opts) if err != nil { logFatal("failed to instantiate nsqd - %s", err) } p.nsqd = nsqd err = p.nsqd.LoadMetadata() if err != nil { logFatal("failed to load metadata - %s", err) } err = p.nsqd.PersistMetadata() if err != nil { logFatal("failed to persist metadata - %s", err) } go func() { err := p.nsqd.Main() if err != nil { p.Stop() os.Exit(1) } }() for { time.Sleep(time.Second) } }
nsqd.exe --lookupd-tcp-address=127.0.0.1:4160