refactor(config): improve config file handling and error messages
- Replace manual address formatting with net.JoinHostPort in tcpClient - Simplify debug/error messages in IsInstanceRunning by removing redundant output - Fix incorrect map reference for RunUser in CreateInstanceHandler - Extract config file creation logic into handleConfigFileCreate - Add auth_token to response data in GetInstanceInfoHandler - Remove redundant AuthToken field from InstanceInfo struct
This commit is contained in:
@@ -42,7 +42,7 @@ func tcpConnect(ipaddr string, port int) error {
|
||||
return fmt.Errorf("already connected")
|
||||
}
|
||||
|
||||
address := fmt.Sprintf("%s:%d", ipaddr, port)
|
||||
address := net.JoinHostPort(ipaddr, fmt.Sprintf("%d", port))
|
||||
conn, err := net.DialTimeout("tcp", address, 3*time.Second)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to connect to %s: %v", address, err)
|
||||
|
||||
Reference in New Issue
Block a user