Skip to content

Commit

Permalink
use loop with list of keys in loadHCL
Browse files Browse the repository at this point in the history
  • Loading branch information
lhitchon committed Mar 9, 2018
1 parent a46a568 commit 250d08f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions app.go
Expand Up @@ -39,13 +39,11 @@ func loadHCL(template string, log LoggingFunction) []interface{} {
}
m := hclData.(map[string]interface{})
results := make([]interface{}, 0)
if m["resource"] != nil {
log("Adding resources")
results = append(results, m["resource"].([]interface{})...)
}
if m["data"] != nil {
log("Adding data")
results = append(results, m["data"].([]interface{})...)
for _, key := range []string{"resource", "data"} {
if m[key] != nil {
log(fmt.Sprintf("Adding %s", key))
results = append(results, m[key].([]interface{})...)
}
}
return results
}
Expand Down

0 comments on commit 250d08f

Please sign in to comment.