prysmaticlabs / prysm

Exit inside non-main function RVV-A0003
Anti-pattern
Major
21 days ago3 years old
calls to log.Fatal only in main() or init() functions
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
calls to log.Fatal only in main() or init() functions
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")
calls to log.Fatal only in main() or init() functions
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)
calls to log.Fatalf only in main() or init() functions
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),
calls to log.Fatalf only in main() or init() functions
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) {