mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
handle an unhandled error in closing the genesis file
This commit is contained in:
parent
3dc549b3d7
commit
b70b3e716a
1 changed files with 6 additions and 1 deletions
|
|
@ -201,7 +201,12 @@ func initGenesis(ctx *cli.Context) error {
|
|||
if err != nil {
|
||||
utils.Fatalf("Failed to read genesis file: %v", err)
|
||||
}
|
||||
defer file.Close()
|
||||
defer func(file *os.File) {
|
||||
err := file.Close()
|
||||
if err != nil {
|
||||
utils.Fatalf("Failed to close the genesis file: %v", err)
|
||||
}
|
||||
}(file)
|
||||
|
||||
genesis := new(core.Genesis)
|
||||
if err := json.NewDecoder(file).Decode(genesis); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue