I am using Go 1.16.4. I am trying to deal with such code:
func (pool *myConnPool) GetPooledConnection() (*myConnection, error) {
go func() {
conn, err := pool.createConn()
if err != nil {
return
}
pool.connections <- conn
}()
select { // <<<< golint warning here
case conn := <-pool.connections:
return pool.packConn(conn), nil
}
}
I am getting following Go linter warning: should use a simple channel send/receive instead of select with a single case (S1000)
at the point marked in the code. Can anyone please explain how to fix that? I am not yet too experienced with Go channels.