Unused parameter in the golang.org/x/net/internal/socks worth removing or not?

83 views
Skip to first unread message

Himanshu Balurkar

unread,
Oct 20, 2024, 3:15:36 PM10/20/24
to golang-nuts
https://github.com/golang/net/blob/5716b9813d2c78aa3bb6e08160517facfb2e84e6/internal/socks/socks.go#L233-L245

At the above link, the address string argument in the validateTarget function is not used anywhere. Unclear why the parameter is there. It is not for the interface satisfaction. 

It might be the case that the address string argument is placed there intentionally for some future plans/modifications.

It might also be the case that this is overlooked. 

Anyways, is this issue worth fixing or not? The simple fix would be to remove that argument. 

Is there anything that I am missing? Highly appreciate any leads!

Thanks!

Ian Lance Taylor

unread,
Oct 20, 2024, 4:03:49 PM10/20/24
to Himanshu Balurkar, golang-nuts
It was most likely just an oversight in the initial commit
(https://go.dev/cl/110135).

It could be fixed, but most fixes of this sort are code churn. As a
general guideline, changes to working code can only break it. We
should only make such changes if there is a clear reason to do so. An
unused parameter is not the worst reason, but it's not the best one
either.

Ian
Reply all
Reply to author
Forward
0 new messages