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 // 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 // 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. // 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 // Source parses ParamValues out of a particular configuration source, given a
// sorted set of possible Params to parse. The returned []ParamValue may contain // sorted set of possible Params to parse.
// duplicates of the same Param's value. in which case the later value takes //
// precedence. // 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 { type Source interface {
Parse([]Param) ([]ParamValue, error) Parse([]Param) ([]ParamValue, error)
} }