Skip to content

Commit

Permalink
fix: infinite loop in generate if the stack is in / (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
i4ki committed Jun 16, 2022
1 parent 8e49f6e commit c791613
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion generate/genfile/genfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,12 @@ func loadGenFileBlocks(rootdir string, cfgdir string) ([]genFileBlock, error) {
}
}

parentRes, err := loadGenFileBlocks(rootdir, filepath.Dir(cfgdir))
parentCfgDir := filepath.Dir(cfgdir)
if parentCfgDir == cfgdir {
return res, nil
}

parentRes, err := loadGenFileBlocks(rootdir, parentCfgDir)
if err != nil {
return nil, err
}
Expand Down
7 changes: 6 additions & 1 deletion generate/genhcl/genhcl.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,12 @@ func loadGenHCLBlocks(rootdir string, cfgdir string) ([]loadedHCL, error) {
}
}

parentRes, err := loadGenHCLBlocks(rootdir, filepath.Dir(cfgdir))
parentCfgDir := filepath.Dir(cfgdir)
if parentCfgDir == cfgdir {
return res, nil
}

parentRes, err := loadGenHCLBlocks(rootdir, parentCfgDir)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit c791613

Please sign in to comment.