-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: passing a non-JSON string to terratag should not panic #123
Conversation
main.go
Outdated
if err != nil { | ||
log.Printf("[ERROR] Invalid input tags! must be a valid JSON.\nInput: %s\nError: %s\n", tags, err.Error()) | ||
os.Exit(1) | ||
} | ||
PanicOnError(err, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this make this line redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yaronya - yes. thanks for pointing it out. Removed.
c48491d
to
ca247fd
Compare
@@ -162,7 +162,10 @@ func tagFileResources(path string, dir string, filter string, tags string, tfVer | |||
func jsonToHclMap(tags string) string { | |||
var tagsMap map[string]string | |||
err := json.Unmarshal([]byte(tags), &tagsMap) | |||
PanicOnError(err, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line removed....
ca247fd
to
f1ce56e
Compare
Print a log message and exit(1) instead.