Upgrading to v2¶
v2 changes the module path and a few methods. The steps for the code of v1:
-
Change the imports from
github.com/insei/tinyconf/...togithub.com/insei/tinyconf/v2/...: -
Parsetakes the context:Parse(conf)isParse(context.Background(), conf). The context stops the requests of the remote drivers. -
The zap adapter is the separate module, zap is not a dependency of the core anymore:
logger.NewZapLogger(l)iszaplogger.New(l)fromgithub.com/insei/tinyconf/logger/zaplogger, see Logging. -
Fields of an embedded struct without the tag are on the level of the embedding struct, like in
encoding/json. Check the keys of such fields in the files and the environment variables. -
Parsereturns the errors: a value that can't be converted to the type of the field, a file that can't be read, a field withrequired:"true"without a value. v1 only logged them and returnednil. All fields are parsed anyway, the errors are returned as one error, see Errors.