pkg/types: safer typecasting for TextUnmarshaler when loading args
authorAithal <aithal@amazon.com>
Mon, 22 May 2017 20:09:19 +0000 (13:09 -0700)
committerAithal <aithal@amazon.com>
Mon, 22 May 2017 20:13:57 +0000 (13:13 -0700)
commit5b4c559d4dcdc42bf2acef179d3e83590a6c79b6
treef8f05e54de044bdb51c62d70828d1d958d526a54
parent8ea1605c26c50928e5fce74c2432d24c95ebd82c
pkg/types: safer typecasting for TextUnmarshaler when loading args

types.LoadArgs does an unsafe typecast for env args key value pairs.
This can cause a panic if the config type fields do not implement
the encoding.TextUnmarshaler interface. This commit modifies it to
do a safe type cast and return an error in such scenarios.
pkg/types/args.go
pkg/types/args_test.go