You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed a regression in behaviour. Here is code for reproducing the issue.
package confitajson
import (
"context""log""testing""github.com/heetch/confita""github.com/heetch/confita/backend/file"
)
funcTestLoad(t*testing.T) {
b:=file.NewBackend("config.json")
varcstruct {
Fieldstring`json:"field"`
}
iferr:=confita.NewLoader(b).Load(context.Background(), &c); err!=nil {
log.Fatalf("failed to load config: %v", err)
}
ifc.Field!="value" {
log.Fatal("field value is not updated")
}
}
Content of config.json file is following:
{
"field": "value"
}
When running this test on the latest confita release, struct field is not updated. But on version v0.7.0 code works fine.
prime@bee ~/C/confitajson> go get github.com/heetch/[email protected]
go: downloading github.com/heetch/confita v0.7.0
prime@bee ~/C/confitajson> go test .
ok github.com/slon/confitajson 0.002s
prime@bee ~/C/confitajson> go get github.com/heetch/confita
go: github.com/heetch/confita upgrade => v0.9.1
prime@bee ~/C/confitajson> go test .
2020/05/27 20:02:34 field value is not updated
FAIL github.com/slon/confitajson 0.002s
FAIL
I noticed a regression in behaviour. Here is code for reproducing the issue.
Content of
config.json
file is following:When running this test on the latest confita release, struct field is not updated. But on version v0.7.0 code works fine.
I also noticed, that removing these 3 lines, seems to fix this issue for me. https://github.com/heetch/confita/blob/master/config.go#L183-L185
Is that change in behaviour intentional, or is it indeed a regression?
The text was updated successfully, but these errors were encountered: