Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support delegation #22

Closed
SchulteMarkus opened this issue Nov 25, 2016 · 2 comments
Closed

Support delegation #22

SchulteMarkus opened this issue Nov 25, 2016 · 2 comments

Comments

@SchulteMarkus
Copy link

Please support delegation.

package main

import (
	"fmt"
	"github.com/caarlos0/env"
)

type Foo struct {
	Food string        `env:"FOOD"`
}

type Bar struct {
	Baz string        `env:"BAZ"`
	Foo
}

func main() {
	bar := Bar{}
	err := env.Parse(&bar)
	if err != nil {
		fmt.Printf("%+v\n", err)
	}
	fmt.Printf("%+v\n", bar)
}

BAZ=1234 FOOD=4321 go run main.go

Is {Baz:1234 Foo:{Food:}}
Feature request {Baz:1234 Foo:{Food:4321}}

@caarlos0
Copy link
Owner

I like this idea.

Will think about it a little more and try to implement.

Thanks for the suggestion!

This was referenced Sep 21, 2017
@caarlos0
Copy link
Owner

fixed on #36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants