I have a golang structure:
type Connection struct {
Write chan []byte
Quit chan bool
}
I'm creating it with:
newConnection := &Connection{make(chan []byte), make(chan bool)}
How to correctly create functional type with Connection parameter and function of this type?
I mean that i want to do something like this:
type Handler func(string, Connection)
and
handler(line, newConnection)
whene handler
is:
func handler(input string, conn tcp.Connection) {}
cannot use newConnection (type *Connection) as type Connection in argument to handler
Thank you.