mcfg: update docs to make running Populate more than once explicitly allowed

This commit is contained in:
Brian Picciano 2019-01-25 16:46:39 -05:00
parent a24262f295
commit b33b157e15
2 changed files with 10 additions and 4 deletions

View File

@ -112,7 +112,9 @@ func populate(params []Param, src Source) error {
}
// Populate uses the Source to populate the values of all Params which were
// added to the given mctx.Context, and all of its children.
// added to the given mctx.Context, and all of its children. Populate may be
// called multiple times with the same mctx.Context, each time will only affect
// the values of the Params which were provided by the respective Source.
//
// Source may be nil to indicate that no configuration is provided. Only default
// values will be used, and if any paramaters are required this will error.

View File

@ -12,9 +12,13 @@ type ParamValue struct {
}
// Source parses ParamValues out of a particular configuration source, given a
// sorted set of possible Params to parse. The returned []ParamValue may contain
// duplicates of the same Param's value. in which case the later value takes
// precedence.
// sorted set of possible Params to parse.
//
// Source should not return ParamValues which were not explicitly set to a value
// by the configuration source.
//
// The returned []ParamValue may contain duplicates of the same Param's value.
// in which case the later value takes precedence.
type Source interface {
Parse([]Param) ([]ParamValue, error)
}