From 5ec6a88a60a7ffbacd41a7e88404aa67cee7608b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Tue, 25 Jul 2023 23:36:33 +0800 Subject: [PATCH] fix: lint --- app/http/controllers/ssh_controller.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/http/controllers/ssh_controller.go b/app/http/controllers/ssh_controller.go index 5e57d1f745..14a4341062 100644 --- a/app/http/controllers/ssh_controller.go +++ b/app/http/controllers/ssh_controller.go @@ -112,16 +112,14 @@ func (r *SshController) Session(ctx http.Context) { } defer ws.Close() - var config *ssh.SSHClientConfig - config = ssh.SSHClientConfigPassword( + config := ssh.SSHClientConfigPassword( r.setting.Get(models.SettingKeySshHost)+":"+r.setting.Get(models.SettingKeySshPort), r.setting.Get(models.SettingKeySshUser), r.setting.Get(models.SettingKeySshPassword), ) - client, err := ssh.NewSSHClient(config) if err != nil { - ws.WriteControl(websocket.CloseMessage, + _ = ws.WriteControl(websocket.CloseMessage, []byte(err.Error()), time.Now().Add(time.Second)) return } @@ -129,7 +127,7 @@ func (r *SshController) Session(ctx http.Context) { turn, err := ssh.NewTurn(ws, client) if err != nil { - ws.WriteControl(websocket.CloseMessage, + _ = ws.WriteControl(websocket.CloseMessage, []byte(err.Error()), time.Now().Add(time.Second)) return }