summaryrefslogtreecommitdiffstats
path: root/tpl/transform
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/transform')
-rw-r--r--tpl/transform/remarshal.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/tpl/transform/remarshal.go b/tpl/transform/remarshal.go
index d5fe96ac6..fd0742b7f 100644
--- a/tpl/transform/remarshal.go
+++ b/tpl/transform/remarshal.go
@@ -49,18 +49,12 @@ func (ns *Namespace) Remarshal(format string, data interface{}) (string, error)
return result.String(), nil
}
-func toFormatMark(format string) (rune, error) {
- // TODO(bep) the parser package needs a cleaning.
- switch format {
- case "yaml":
- return rune(parser.YAMLLead[0]), nil
- case "toml":
- return rune(parser.TOMLLead[0]), nil
- case "json":
- return rune(parser.JSONLead[0]), nil
+func toFormatMark(format string) (metadecoders.Format, error) {
+ if f := metadecoders.FormatFromString(format); f != "" {
+ return f, nil
}
- return 0, errors.New("failed to detect target data serialization format")
+ return "", errors.New("failed to detect target data serialization format")
}
func detectFormat(data string) (metadecoders.Format, error) {