【文件属性】:
文件名称:env:简单的lib可以将环境变量解析为结构
文件大小:17KB
文件格式:ZIP
更新时间:2021-04-27 14:01:59
golang environment-variables Go
环保
简单的lib可以在Go中将env解析为结构。
例子
一个非常基本的例子:
package main
import (
"fmt"
"time"
// if using go modules
"github.com/caarlos0/env/v6"
// if using dep/others
"github.com/caarlos0/env"
)
type config struct {
Home string `env:"HOME"`
Port int `env:"PORT" envDefault:"3000"`
IsProduction bool `env:"PRODUCTION"`
Hosts [] string `env:"HOSTS" envS
【文件预览】:
env-master
----.goreleaser.yml(133B)
----env.go(10KB)
----.github()
--------dependabot.yml(355B)
--------FUNDING.yml(19B)
--------workflows()
----.gorelangci.yml(84B)
----LICENSE.md(1KB)
----.gitignore(31B)
----env_test.go(31KB)
----Makefile(763B)
----go.sum(1024B)
----README.md(6KB)
----go.mod(87B)