我们可以在Go中使用来自不同侦听器的select到Accept()吗?

Just as the following codes:

for {
    select {
    case conn, err := listener1.Accept():
        if err != nil {
            log.Fatal(err)
        }
        go handleConn1(conn)
    case conn, err := listener2.Accept():
        if err != nil {
            log.Fatal(err)
        }
        go handleConn1(conn)
    }
}

While the editor tells me something wrong with select

Can we implement something like this in Go?

select only works with channels (see more here: https://gobyexample.com/select)

In your case, you could span two goroutines so that each of them waits for the Accept of one listener and processes the connection:

go {
    for {
        conn, err := listener1.Accept():
        if err != nil {
            log.Fatal(err)
        }
        handleConn1(conn)
    }
}
go {
    for {
        conn, err := listener2.Accept():
        if err != nil {
            log.Fatal(err)
        }
        handleConn2(conn)
    }
}