Apply go fix -any ./...

This commit is contained in:
Michael Eischer
2026-07-22 22:25:18 +02:00
parent d4088aa09b
commit 32e9869cc8
63 changed files with 197 additions and 197 deletions
+4 -4
View File
@@ -16,7 +16,7 @@ type Options map[string]string
var opts []Help
// Register allows registering options so that they can be listed with List.
func Register(ns string, cfg interface{}) {
func Register(ns string, cfg any) {
opts = appendAllOptions(opts, ns, cfg)
}
@@ -28,7 +28,7 @@ func List() (list []Help) {
}
// appendAllOptions appends all options in cfg to opts, sorted by namespace.
func appendAllOptions(opts []Help, ns string, cfg interface{}) []Help {
func appendAllOptions(opts []Help, ns string, cfg any) []Help {
for _, opt := range listOptions(cfg) {
opt.Namespace = ns
opts = append(opts, opt)
@@ -39,7 +39,7 @@ func appendAllOptions(opts []Help, ns string, cfg interface{}) []Help {
}
// listOptions returns a list of options of cfg.
func listOptions(cfg interface{}) (opts []Help) {
func listOptions(cfg any) (opts []Help) {
// resolve indirection if cfg is a pointer
v := reflect.Indirect(reflect.ValueOf(cfg))
@@ -145,7 +145,7 @@ func (o Options) Extract(ns string) Options {
// Apply sets the options on dst via reflection, using the struct tag `option`.
// The namespace argument (ns) is only used for error messages.
func (o Options) Apply(ns string, dst interface{}) error {
func (o Options) Apply(ns string, dst any) error {
v := reflect.ValueOf(dst).Elem()
fields := make(map[string]reflect.StructField)
+3 -3
View File
@@ -247,7 +247,7 @@ func TestListOptions(t *testing.T) {
}{}
tests := []struct {
cfg interface{}
cfg any
opts []Help
}{
{
@@ -298,11 +298,11 @@ func TestListOptions(t *testing.T) {
func TestAppendAllOptions(t *testing.T) {
tests := []struct {
cfgs map[string]interface{}
cfgs map[string]any
opts []Help
}{
{
map[string]interface{}{
map[string]any{
"local": struct {
Foo string `option:"foo" help:"bar text help"`
}{},