Skip to content

Commit

Permalink
Fix panic on init failure like conflicting import
Browse files Browse the repository at this point in the history
  • Loading branch information
mumoshu committed Feb 13, 2021
1 parent 5ca020a commit 4f4dc7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/app/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ func newApp(app *App, cc *HCL2Config, importDir func(string) (*App, error)) (*Ap
for _, g := range globals {
merged, err := mergeParamsAndOpts(g, root)
if err != nil {
return nil, fmt.Errorf("merging globals: %w", err)
return app, fmt.Errorf("merging globals: %w", err)
}

root = *merged
Expand Down
6 changes: 5 additions & 1 deletion variant.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,11 @@ func getMergedParamsAndOpts(
func (m *Main) initApp(setup app.Setup) (*app.App, error) {
ap, err := app.New(setup)
if err != nil {
ap.PrintError(err)
if ap == nil {
fmt.Fprintf(os.Stderr, "%+v\n", err)
} else {
ap.PrintError(err)
}

//nolint:wrapcheck
return nil, err
Expand Down

0 comments on commit 4f4dc7a

Please sign in to comment.