avoid fmt in happy path

This commit is contained in:
matryer
2021-02-25 07:39:42 +00:00
parent f71ce7913f
commit 1bb91634f7

View File

@@ -3,6 +3,7 @@ package menumanager
import (
"encoding/json"
"fmt"
"strconv"
"sync"
"github.com/pkg/errors"
@@ -13,11 +14,12 @@ var trayMenuID int
var trayMenuIDMutex sync.Mutex
func generateTrayID() string {
var idStr string
trayMenuIDMutex.Lock()
result := fmt.Sprintf("%d", trayMenuID)
idStr = strconv.Itoa(trayMenuID)
trayMenuID++
trayMenuIDMutex.Unlock()
return result
return idStr
}
type TrayMenu struct {