In the following example
package main
import (
"fmt"
"github.com/xeger/flatpack"
)
type Config struct {
Database struct {
Host []string `flatpack:"required"`
Port int
}
Awesome struct {
NotNeeded map[string]string
Needed int
ReallyNeeded string
}
WidgetFactory string
}
func main() {
var config = Config{}
err := flatpack.Unmarshal(&config)
if err != nil {
fmt.Printf("Failed to load configuration: %v\n", err.Error())
}
fmt.Println(config)
}
Running
DATABASE_HOST=[\"foo\"] AWESOME_NEEDED=10 go run main.go
doesn't populate the Needed field. But if I remove the NotNeeded map field, it works fine.
In the following example
Running
doesn't populate the Needed field. But if I remove the
NotNeededmap field, it works fine.