225 log.Fatal(err)
226 }
227 if genState == nil || genState.IsNil() {
228 log.Fatal("cannot create genesis state: no eth1 http endpoint defined")229 }
230 }
231
222 // if a genesis state exists, we can continue on.
223 genState, err := s.cfg.beaconDB.GenesisState(s.ctx)
224 if err != nil {
225 log.Fatal(err)226 }
227 if genState == nil || genState.IsNil() {
228 log.Fatal("cannot create genesis state: no eth1 http endpoint defined")
41 }
42 walletDirPath := cliCtx.String(flags.WalletDirFlag.Name)
43 if walletDirPath == "" {
44 log.Fatal("--wallet-dir not specified")45 }
46 gatewayHost := cliCtx.String(flags.GRPCGatewayHost.Name)
47 gatewayPort := cliCtx.Int(flags.GRPCGatewayPort.Name)
408
409 // If both a complete and minimal database exist, return on error.
410 if completeDatabaseExists && minimalDatabaseExists {
411 log.Fatalf(412 "Both complete (%s) and minimal slashing (%s) protection databases exist. Please delete one of them.",
413 path.Join(kvDataDir, kv.ProtectionDbFileName),
414 path.Join(fileSystemDataDir, filesystem.DatabaseDirName),
109 case params.MainnetName:
110 // Do nothing
111 default:
112 log.Fatalf("Unknown network provided: %s", requestBlocksFlags.Network)113 }
114
115 if cliCtx.IsSet(cmd.ChainConfigFileFlag.Name) {
Packages exposing functions that can stop program execution by exiting are hard to reuse. Program exits in functions other than main() or init() are not encouraged.
func nonMainFunc() {
safelyExit := true // somehow arrive at this value
if safelyExit {
os.Exit(0)
}
}
func main() {
nonMainFunc()
}
func nonMainFunc() bool {
safelyExit := true // somehow arrive at this value
}
func main() {
safelyExit := nonMainFunc()
if safelyExit {
os.Exit(0)
}
}