Closed marcosnils closed 8 years ago
@teepark I found another issue with the same commit. If a struct implements the Decode
function it won't be called because the introduced code will try to parse the struct internally instead of using the proper Decode
function.
Even though I can provide a fix, I'm not sure how you want this to work but it's currently breaking backwards compatibility.
Example:
package main
import (
"fmt"
"os"
"github.com/kelseyhightower/envconfig"
)
type TestDecode struct {
Value string
}
func (t *TestDecode) Decode(env string) error {
t.Value = "Some value"
return nil
}
type Config struct {
Test TestDecode `envconfig:"decode"`
}
func main() {
os.Setenv("TEST_DECODE", "one")
c := Config{}
envconfig.Process("test", &c)
fmt.Println(c.Test.Value) // Should print "Some Value"
}
This was working before the mentioned commit @elgris @kelseyhightower
Hi, this use case was working before commit 31176c57a5eacded4755c5f9eac8eb5a603cfbfd
@elgris @teepark @kelseyhightower :bell: