streadway / amqp

Go client for AMQP 0.9.1
http://godoc.org/github.com/streadway/amqp
BSD 2-Clause "Simplified" License
4.88k stars 621 forks source link

Why use struct instead of pointer? #517

Open super9du opened 3 years ago

super9du commented 3 years ago

https://github.com/streadway/amqp/blob/e6b33f460591b0acb2f13b04ef9cf493720ffe17/connection.go#L223

func Open(conn io.ReadWriteCloser, config Config) (*Connection, error) {
    c := &Connection{
        conn:      conn,
        writer:    &writer{bufio.NewWriter(conn)},
        channels:  make(map[uint16]*Channel),
        rpc:       make(chan message),
        sends:     make(chan time.Time),
        errors:    make(chan *Error, 1),
        deadlines: make(chan readDeadliner, 1),
    }
    go c.reader(conn)
    return c, c.open(config)
}
super9du commented 3 years ago

the arg "config" is not a pointer.