@ -1,7 +1,7 @@
// Disabling building of yaml support in cases where golang is 1.0 or 1.1
// as the encoding library is not implemented or supported.
// +build !go1,!go1.1
// +build go1.2
package altsrc
@ -23,19 +23,19 @@ type yamlSourceContext struct {
// NewYamlSourceFromFile creates a new Yaml InputSourceContext from a filepath.
func NewYamlSourceFromFile ( file string ) ( InputSourceContext , error ) {
y mlLoader := & yamlSourceLoader { FilePath : file }
y sc := & yamlSourceContext { FilePath : file }
var results map [ string ] interface { }
err := readCommandYaml ( ys l . FilePath , & results )
err := readCommandYaml ( ys c . FilePath , & results )
if err != nil {
return fmt . Errorf ( "Unable to load Yaml file '%s': inner error: \n'%v'" , f ilePath, err . Error ( ) )
return nil , fmt . Errorf ( "Unable to load Yaml file '%s': inner error: \n'%v'" , ysc. F ilePath, err . Error ( ) )
}
return & MapInputSource { valueMap : results } , nil
}
// NewYamlSourceFromFlagFunc creates a new Yaml InputSourceContext from a provided flag name and source context.
func NewYamlSourceFromFlagFunc ( flagFileName string ) func ( InputSourceContext, error ) {
return func ( context cli . Context ) {
func NewYamlSourceFromFlagFunc ( flagFileName string ) func ( context * cli . Context ) ( InputSourceContext, error ) {
return func ( context * cli . Context ) ( InputSourceContext , error ) {
filePath := context . String ( flagFileName )
return NewYamlSourceFromFile ( filePath )
}