Tips: 建议先看下官方文档,如何使用env再看源码 项目信息 地址:https://github.com/caarlos0/env 描述:一个可以parse环境变量到go struct的简单的三方库 版本:tag: v6.8.0 源码阅读 入口函数(Parse) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 // Parse parses a struct containing `env` tags and loads its values from // environment variables. func Parse(v interface{}, opts ...Options) error { return ParseWithFuncs(v, map[reflect.Type]ParserFunc{}, opts...) } // ParseWithFuncs is the same as `Parse` except it also allows the user to pass // in custom parsers.……

阅读全文