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

net: incorrect docs on KeepAlive field of Dialer #29089

mikioh opened this Issue Dec 4, 2018 · 1 comment


None yet
3 participants

mikioh commented Dec 4, 2018

What version of Go are you using (go version)?


Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?

doesn't matter

What did you do?

Run "go doc net Dialer" and took a look at the output

What did you expect to see?

At least the docs introduced by #23459 never uses the phrase "keep-alive period" because the existing implementation tries to tweak the keepalive idle and probe intervals, not the entire keepalive period.

What did you see instead?`

// KeepAlive specifies the keep-alive period for an active
// network connection.
// If zero, keep-alives are enabled if supported by the protocol
// and operating system. Network protocols or operating systems
// that do not support keep-alives ignore this field.
// If negative, keep-alives are disabled.
KeepAlive time.Duration

FWIW, SetKeepAlivePeriod on TCPConn says:

// SetKeepAlivePeriod sets period between keep alives.
func (c *TCPConn) SetKeepAlivePeriod(d time.Duration) error {

@mikioh mikioh added the help wanted label Dec 4, 2018

@mikioh mikioh added this to the Go1.12 milestone Dec 4, 2018


This comment has been minimized.


mikioh commented Dec 4, 2018

In addition, I personally prefer implementing KeepAlive as an entire keepalive period rather than idle and probe intervals like CL 107196.

@bradfitz bradfitz self-assigned this Dec 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment