Closed mozarik closed 3 hours ago
Sigh im using envconfig in the annotations my bad. u can delete this issue
but i found a bug
something like this is FAILED test
type DB struct {
Name string `env:"DB_HOST_NAME,default=test,overwrite"`
}
func TestOverWriteWithEnv2(t *testing.T) {
os.Clearenv()
os.Setenv("DB_HOST_NAME", "bar")
dbCred := &DB{
Name: "meta-name",
}
err := envconfig.Process(context.TODO(), dbCred)
require.NoError(t, err)
assert.Equal(t, "bar", dbCred.Name)
}
but if i change it to this it PASS
type DB struct {
Name string `env:"DB_HOST_NAME,overwrite,default=test"`
}
Im using os.Setenv and Lookuper function. bot have the same result is not overwrite non-zero value the struct have. Is this expected behaviour. Or is there something wrong with my code ?