From 5fbf9c650e42c8a3f9cd98dc83b76623195fb1f5 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 27 May 2020 00:16:33 +0100 Subject: [PATCH] isupport List.Tokens map[string]*string -> map[string]string --- irc/isupport/list.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/irc/isupport/list.go b/irc/isupport/list.go index 9f3e95cb..baafa146 100644 --- a/irc/isupport/list.go +++ b/irc/isupport/list.go @@ -15,7 +15,7 @@ const ( // List holds a list of ISUPPORT tokens type List struct { - Tokens map[string]*string + Tokens map[string]string CachedReply [][]string } @@ -27,27 +27,27 @@ func NewList() *List { } func (il *List) Initialize() { - il.Tokens = make(map[string]*string) + il.Tokens = make(map[string]string) il.CachedReply = make([][]string, 0) } // Add adds an RPL_ISUPPORT token to our internal list func (il *List) Add(name string, value string) { - il.Tokens[name] = &value + il.Tokens[name] = value } // AddNoValue adds an RPL_ISUPPORT token that does not have a value func (il *List) AddNoValue(name string) { - il.Tokens[name] = nil + il.Tokens[name] = "" } // getTokenString gets the appropriate string for a token+value. -func getTokenString(name string, value *string) string { - if value == nil || len(*value) == 0 { +func getTokenString(name string, value string) string { + if len(value) == 0 { return name } - return fmt.Sprintf("%s=%s", name, *value) + return fmt.Sprintf("%s=%s", name, value) } // GetDifference returns the difference between two token lists. @@ -69,7 +69,7 @@ func (il *List) GetDifference(newil *List) [][]string { // append added tokens for name, value := range newil.Tokens { newval, exists := il.Tokens[name] - if exists && ((value == nil && newval == nil) || (value != nil && newval != nil && *value == *newval)) { + if exists && value == newval { continue }