Couple more errors found by linting

This commit is contained in:
Kovid Goyal
2022-09-21 19:51:09 +05:30
parent 4b6bae576d
commit 7c41737370
3 changed files with 4 additions and 3 deletions

View File

@@ -263,7 +263,7 @@ func get_password(password string, password_file string, password_env string, us
} }
ttyf, err := os.Open(tty.Ctermid()) ttyf, err := os.Open(tty.Ctermid())
if err == nil { if err == nil {
err = unix.Dup2(int(ttyf.Fd()), int(os.Stdin.Fd())) err = unix.Dup2(int(ttyf.Fd()), int(os.Stdin.Fd())) //nolint ineffassign err is returned indicating duping failed
ttyf.Close() ttyf.Close()
} }
} }

View File

@@ -70,6 +70,9 @@ func TestRCSerialization(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
raw, err := io_data.serializer(&rc) raw, err := io_data.serializer(&rc)
if err != nil {
t.Fatal(err)
}
var ec utils.EncryptedRemoteControlCmd var ec utils.EncryptedRemoteControlCmd
err = json.Unmarshal([]byte(raw), &ec) err = json.Unmarshal([]byte(raw), &ec)
if err != nil { if err != nil {

View File

@@ -108,7 +108,6 @@ func simple_socket_io(conn *net.Conn, io_data *rc_io_data) (serialized_response
const ( const (
BEFORE_FIRST_ESCAPE_CODE_SENT = iota BEFORE_FIRST_ESCAPE_CODE_SENT = iota
SENDING SENDING
WAITING_FOR_RESPONSE
) )
state := BEFORE_FIRST_ESCAPE_CODE_SENT state := BEFORE_FIRST_ESCAPE_CODE_SENT
@@ -124,7 +123,6 @@ func simple_socket_io(conn *net.Conn, io_data *rc_io_data) (serialized_response
return return
} }
if len(chunk) == 0 { if len(chunk) == 0 {
state = WAITING_FOR_RESPONSE
break break
} }
err = write_many_to_conn(conn, []byte(cmd_escape_code_prefix), chunk, []byte(cmd_escape_code_suffix)) err = write_many_to_conn(conn, []byte(cmd_escape_code_prefix), chunk, []byte(cmd_escape_code_suffix))