From f73ae368701ca150949be6758b3e127ae4b57e5f Mon Sep 17 00:00:00 2001 From: e-zk Date: Sat, 16 Oct 2021 01:31:13 +1000 Subject: [PATCH] misc: fix getconfig reflect.TypeOf() was expecting a value (pointer given) - c.Config is now dereferenced in call to TypeOf() reflect.ValueOf() was expecting a pointer (pointer to pointer given) - c.Config passed as-is since it was already a pointer --- commands/misc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/misc.go b/commands/misc.go index 66e7d7a..ccba660 100644 --- a/commands/misc.go +++ b/commands/misc.go @@ -88,12 +88,12 @@ func (c *Commands) handleGetConfig(s *discordgo.Session, m *discordgo.MessageCre msg := "" - rt := reflect.TypeOf(c.Config) + rt := reflect.TypeOf(*c.Config) for i := 0; i < rt.NumField(); i++ { x := rt.Field(i) tagVal := strings.Split(x.Tag.Get("json"), ",")[0] tagName := x.Name - prop := reflect.ValueOf(&c.Config).Elem().FieldByName(tagName) + prop := reflect.ValueOf(c.Config).Elem().FieldByName(tagName) if configKey == "all" { switch prop.Interface().(type) {