Skip to content

Commit

Permalink
Fix/ignore fields of unsupported type (#3)
Browse files Browse the repository at this point in the history
* Does no longer panic on unsupported fields

* Updates the changelog
  • Loading branch information
matzefriedrich authored Jun 12, 2024
1 parent 9bf40da commit d5a0938
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]


## [0.2.4] - cobra-extensions v0.2.4, 2024-06-12
## [0.2.5] - cobra-extensions v0.2.5, 2024-06-12

### Fixes

- The `reflection` module panicked when reflecting fields with an interface type.
- The `reflection` module ignores fields of unsupported types


## [0.2.3] - cobra-extensions v0.2.3, 2024-04-25
Expand Down
2 changes: 0 additions & 2 deletions pkg/reflection/reflection.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ func tryReflectArgumentsDescriptor(m ReflectedObject, target ArgumentsDescriptor
hasCommandArgs = true
}
}
default:
panic("unhandled default case")
}
})

Expand Down
3 changes: 2 additions & 1 deletion pkg/typed_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ func Test_CreateTypedCommand(t *testing.T) {
}

type logger struct {
w io.Writer
w io.Writer
unsupportedFieldType int8
}

type testCommand2 struct {
Expand Down

0 comments on commit d5a0938

Please sign in to comment.