kelseyhightower / envconfig

Golang library for managing configuration data from environment variables
MIT License
5.07k stars 382 forks source link

Better support an empty "prefix" #37

Closed teepark closed 8 years ago

teepark commented 8 years ago

It could use a special case for "":

package main

import (
    "fmt"
    "os"
    "github.com/kelseyhightower/envconfig"
)

var conf = struct {
    Field string `required:"true"`
}{}

func main() {
    os.Setenv("FIELD", "foobar")
    envconfig.MustProcess("", &conf)
    fmt.Println(conf.Field)
}
panic: required key _FIELD missing value