Replacing usages of fmt.Sprint with faster alternatives

Signed-off-by: Philippe Antoine <contact@catenacyber.fr>
Этот коммит содержится в:
Catena cyber
2023-11-03 11:18:18 +01:00
коммит произвёл GitHub
родитель 43f4734eae
Коммит 04e7b6bc9e
8 изменённых файлов: 21 добавлений и 19 удалений

Просмотреть файл

@@ -10,6 +10,7 @@ import (
"fmt"
"os"
"os/user"
"strconv"
"syscall"
"github.com/isacikgoz/prompt"
@@ -38,7 +39,7 @@ func checkValidSocket(socketPath string) error {
return fmt.Errorf("cannot get owner of the file %q", socketPath)
}
// if user id is "0", they are root and we should avoid this check
if fmt.Sprint(s.Uid) != cUser.Uid && cUser.Uid != "0" {
if strconv.FormatUint(uint64(s.Uid), 10) != cUser.Uid && cUser.Uid != "0" {
return fmt.Errorf("owner of the file %q must be the same user running mmctl", socketPath)
}