mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-05-09 18:23:21 +08:00
refactor: improve performance by optimizing string conversions
- Add the `strconv` import. - Replace `fmt.Sprintf` with `strconv.Itoa` for converting UID and GID to string. Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
parent
dc7ab75e3b
commit
9376ede4c6
@ -7,6 +7,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@ -977,8 +978,8 @@ func TestSSHWithTestcontainers(t *testing.T) {
|
||||
Image: "lscr.io/linuxserver/openssh-server:latest",
|
||||
ExposedPorts: []string{"2222/tcp"}, // Default port for this image is 2222
|
||||
Env: map[string]string{
|
||||
"PUID": fmt.Sprintf("%d", os.Getuid()), // Use current user's UID
|
||||
"PGID": fmt.Sprintf("%d", os.Getgid()), // Use current user's GID
|
||||
"PUID": strconv.Itoa(os.Getuid()), // Use current user's UID
|
||||
"PGID": strconv.Itoa(os.Getgid()), // Use current user's GID
|
||||
"USER_NAME": "testuser",
|
||||
"USER_PASSWORD": "testpass",
|
||||
"PASSWORD_ACCESS": "true", // Enable password authentication
|
||||
|
Loading…
Reference in New Issue
Block a user