pulumi/pkg/encoding/init.go
joeduffy c20c151edf Use assertions in more places
This change mostly replaces explicit if/then/glog.Fatalf calls with
util.Assert calls.  In addition, it adds a companion util.Fail family
of methods that does the same thing as a failed assertion, except that
it is unconditional.
2016-11-19 16:13:13 -08:00

25 lines
570 B
Go

// Copyright 2016 Marapongo, Inc. All rights reserved.
package encoding
import (
"github.com/marapongo/mu/pkg/util"
"github.com/marapongo/mu/pkg/workspace"
)
func init() {
// Ensure a marshaler is available for every possible Mufile extension
Marshalers = make(map[string]Marshaler)
for _, ext := range workspace.MufileExts {
switch ext {
case ".json":
Marshalers[ext] = &jsonMarshaler{}
case ".yml":
fallthrough
case ".yaml":
Marshalers[ext] = &yamlMarshaler{}
default:
util.FailMF("No Marshaler available for MufileExt %v", ext)
}
}
}