Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why use struct instead of pointer? #517

Open
super9du opened this issue Oct 26, 2021 · 1 comment
Open

Why use struct instead of pointer? #517

super9du opened this issue Oct 26, 2021 · 1 comment

Comments

@super9du
Copy link

func Open(conn io.ReadWriteCloser, config Config) (*Connection, error) {

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
Copy link
Author

super9du commented Nov 1, 2021

the arg "config" is not a pointer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant