5f33292496
This change just moves the assertion/failure functions from the pkg/util package to pkg/util/contract, so things read a bit nicer (i.e., `contract.Assert(x)` versus `util.Assert(x)`).
25 lines
502 B
Go
25 lines
502 B
Go
// Copyright 2016 Marapongo, Inc. All rights reserved.
|
|
|
|
package encoding
|
|
|
|
import (
|
|
"github.com/marapongo/mu/pkg/util/contract"
|
|
)
|
|
|
|
func init() {
|
|
// Ensure a marshaler is available for every possible Mufile extension
|
|
Marshalers = make(map[string]Marshaler)
|
|
for _, ext := range Exts {
|
|
switch ext {
|
|
case ".json":
|
|
Marshalers[ext] = JSON
|
|
case ".yml":
|
|
fallthrough
|
|
case ".yaml":
|
|
Marshalers[ext] = YAML
|
|
default:
|
|
contract.FailMF("No Marshaler available for MufileExt %v", ext)
|
|
}
|
|
}
|
|
}
|