fix the code:

errors:
# command-line-arguments
.\main.go:8:5: "os" imported and not used
.\main.go:28:26: undefined: ssh.ServerConfig
.\main.go:33:26: undefined: Asset
.\main.go:40:25: undefined: ssh.ParsePrivateKey
.\main.go:48:14: undefined: ssh.NewChanIdiom
.\main.go:48:27: undefined: s
.\main.go:57:32: undefined: ssh.ConnMetadata
.\main.go:110:56: rw.ReadCh undefined (type io.ReadWriter has no field or method ReadCh)
.\main.go:128:24: rw.ReadCh undefined (type io.ReadWriter has no field or method ReadCh)

code:

package main

import (
    "fmt"
    "strings"
    "github.com/gliderlabs/ssh"
    "golang.org/x/crypto/ssh/terminal"
    "os"
    "io"
)

var (
    users = map[string]string{
        "alice":   "password1",
        "bob":     "password2",
        "charlie": "password3",
    }

    // Create a custom ReadWriter
    rw io.ReadWriter
)

func main() {
    // Attach the sessionHandler to the SSH server
    ssh.Handle(sessionHandler)

    // Set up server configuration
    serverConfig := &ssh.ServerConfig{
        PasswordCallback: passwordCallback,
    }

    // Generate private key and check for errors
    privateBytes, err := Asset("private_key.pem")
    if err != nil {
        fmt.Println("Failed to load private key:", err)
        return
    }

    // Add the private key to the server’s configuration
    private, err := ssh.ParsePrivateKey(privateBytes)
    if err != nil {
        fmt.Println("Failed to parse private key:", err)
        return
    }
    serverConfig.AddHostKey(private)

    // Create a custom ReadWriter using the session’s channel
    rw = ssh.NewChanIdiom(s)

    // Start the SSH server
    err = ssh.ListenAndServe(":2222", nil, serverConfig)
    if err != nil {
        fmt.Println("Error starting SSH server:", err)
    }
}

func passwordCallback(conn ssh.ConnMetadata, password []byte) (*ssh.Permissions, error) {
    username := conn.User()

    storedPassword, found := users[strings.TrimSpace(username)]
    if found && storedPassword == string(password) {
        return nil, nil
    }

    return nil, fmt.Errorf("login failed")
}

func sessionHandler(s ssh.Session) {
    fmt.Fprint(s, "Welcome to cartel!\n\n")
    if !login(s) {
        fmt.Fprintln(s, "Login failed. Goodbye!")
        return
    }
    username := s.User()
    fmt.Fprintf(s, "Welcome, %s!\n\n", username)

    cmdChan := make(chan string)
    go readInput(s, cmdChan)

    for {
        fmt.Fprintf(s, "[%s@cartel]~$ ", username)
        select {
        case cmd := <-cmdChan:
            cmd = strings.TrimSpace(cmd)
            switch cmd {
            case "help":
                showHelp(s)
            case "whoami":
                showUsername(s, username)
            case "clear":
                clearScreen(s)
            case "exit":
                return
            default:
                fmt.Fprintf(s, "Command not found. Type ‘help’ for available commands.\n")
            }
        case <-s.Context().Done():
            return
        }
    }
}

func login(s ssh.Session) bool {
    fmt.Fprint(s, "Please enter your username: ")
    var username string
    fmt.Fscan(s, &username)
    fmt.Fprintln(s)

    fmt.Fprint(s, "Please enter your password: ")
    passwordBytes, err := terminal.ReadPassword(int(rw.ReadCh().ReadByte()))
    if err != nil {
        return false
    }
    fmt.Fprintln(s)

    password := string(passwordBytes)
    storedPassword, found := users[strings.TrimSpace(username)]
    if found && storedPassword == password {
        return true
    }

    return false
}

func readInput(s ssh.Session, cmdChan chan<- string) {
    var line string
    for {
        fmt.Fscanln(rw.ReadCh(), &line)
        cmdChan <- line
    }
}

func showHelp(s ssh.Session) {
    helpText := `Available commands:
	help - I forgor
	whoami - display your username
	clear - clear the screen`

    fmt.Fprintln(s, helpText)
}

func showUsername(s ssh.Session, username string) {
    fmt.Fprintf(s, "You are logged in as: %s\n", username)
}

func clearScreen(s ssh.Session) {
    fmt.Fprint(s, "\033[H\033[2J")
}




# command-line-arguments
.\main.go:8:5: "os" imported and not used
.\main.go:28:26: undefined: ssh.ServerConfig
.\main.go:33:26: undefined: Asset
.\main.go:40:25: undefined: ssh.ParsePrivateKey
.\main.go:48:14: undefined: ssh.NewChanIdiom
.\main.go:48:27: undefined: s
.\main.go:57:32: undefined: ssh.ConnMetadata
.\main.go:110:56: rw.ReadCh undefined (type io.ReadWriter has no field or method ReadCh)
.\main.go:128:24: rw.ReadCh undefined (type io.ReadWriter has no field or method ReadCh)