Skip to content

Commit

Permalink
revert to uppercase
Browse files Browse the repository at this point in the history
  • Loading branch information
miladrahimi committed Jun 19, 2022
1 parent 37088ff commit f4c2c5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (c *Config) setupStruct(s interface{}) error {
sType := reflect.TypeOf(s)
if sType != nil && sType.Kind() == reflect.Ptr {
if elem := sType.Elem(); elem.Kind() == reflect.Struct {
if m := reflect.ValueOf(s).MethodByName("setup"); m.IsValid() {
if m := reflect.ValueOf(s).MethodByName("Setup"); m.IsValid() {
v := m.Call([]reflect.Value{})
if len(v) == 1 && v[0].CanInterface() {
if v[0].IsNil() {
Expand Down
6 changes: 3 additions & 3 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ type FullConfig struct {
Sex Sex
}

func (fc *FullConfig) setup() error {
func (fc *FullConfig) Setup() error {
if fc.SexRaw == 0 {
fc.Sex = Male
} else if fc.SexRaw == 1 {
fc.Sex = Female
} else {
return errors.New("app: invalid sex")
return errors.New("invalid sex")
}

return nil
Expand Down Expand Up @@ -90,7 +90,7 @@ func TestConfig_Feed_With_Setup_Returning_Error(t *testing.T) {
f2 := feeder.Env{}

err := config.New().AddFeeder(f1, f2).AddStruct(c).Feed()
assert.Error(t, err, "app: invalid sex")
assert.Error(t, err, "invalid sex")
}

func TestConfig_ReFeeding(t *testing.T) {
Expand Down

0 comments on commit f4c2c5a

Please sign in to comment.