871 Domain: domain,
872 }
873
874 key := strings.Join([]string{strconv.FormatUint(uint64(req.Epoch), 10), hex.EncodeToString(req.Domain)}, ",") 875
876 if val, ok := v.domainDataCache.Get(key); ok {
877 v.domainDataLock.RUnlock()
Some string concatenation operations such as strings.Join
called with a single
or a two element slice can be simplified using binary operators.
This also improves performance as it doesn't need to allocate a new slice and iterate through it.
func foo(x, y string) string {
return strings.Join([]string{x, y}, "_")
}
func foo(x, y string) string {
return x + "_" + y
}