From 22cac33fe7573d1bd3ee1751d5e8532b1d63fcf5 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 11 Jul 2021 19:53:23 -0700 Subject: [PATCH] ipn: remove an unnecessary lazy map init on read path It's okay to read from a nil map. Signed-off-by: Brad Fitzpatrick --- ipn/store.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/ipn/store.go b/ipn/store.go index acce235d2..9d5b5829e 100644 --- a/ipn/store.go +++ b/ipn/store.go @@ -67,9 +67,6 @@ func (s *MemoryStore) String() string { return "MemoryStore" } func (s *MemoryStore) ReadState(id StateKey) ([]byte, error) { s.mu.Lock() defer s.mu.Unlock() - if s.cache == nil { - s.cache = map[StateKey][]byte{} - } bs, ok := s.cache[id] if !ok { return nil, ErrStateNotExist