• Dmitri Shuralyov's avatar
    net/http: improve signature of Redirect, NewRequest · 2abd8aeb
    Dmitri Shuralyov authored
    In CL https://golang.org/cl/4893043 (6 years ago), a new package named
    "url" was created (it is currently known as "net/url"). During that
    change, some identifier name collisions were introduced, and two
    parameters in net/http were renamed to "urlStr".
    
    Since that time, Go has continued to put high emphasis on the quality
    and readability of the documentation. Sometimes, that means making small
    sacrifices in the implementation details of a package to ensure that
    the godoc reads better, since that's what the majority of users interact
    with. See https://golang.org/s/style#named-result-parameters:
    
    > Clarity of docs is always more important than saving a line or two
    > in your function.
    
    I think the "urlStr" parameter name is suboptimal for godoc purposes,
    and just "url" would be better.
    
    During the review of https://golang.org/cl/4893043, it was also noted
    by @rsc that having to rename parameters named "url" was suboptimal:
    
    > It's unfortunate that naming the package url means
    > you can't have a parameter or variable named url.
    
    However, at the time, the name of the url package was still being
    decided, and uri was an alternative name under consideration.
    The reason urlStr was chosen is because it was a lesser evil
    compared to naming the url package uri instead:
    
    > Let's not get hung up on URI vs. URL, but I'd like s/uri/urlStr/ even for just
    > that the "i" in "uri" looks very similar to the "l" in "url" in many fonts.
    
    > Please let's go with urlStr instead of uri.
    
    Now that we have the Go 1 compatibility guarantee, the name of the
    net/url package is fixed. However, it's possible to improve the
    signature of Redirect, NewRequest functions in net/http package
    for godoc purposes by creating a package global alias to url.Parse,
    and renaming urlStr parameter to url in the exported funcs. This CL
    does so.
    
    Updates #21077.
    
    Change-Id: Ibcc10e3825863a663e6ad91b6eb47b1862a299a6
    Reviewed-on: https://go-review.googlesource.com/49930
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    2abd8aeb
Name
Last commit
Last update
..
archive Loading commit data...
bufio Loading commit data...
builtin Loading commit data...
bytes Loading commit data...
cmd Loading commit data...
compress Loading commit data...
container Loading commit data...
context Loading commit data...
crypto Loading commit data...
database/sql Loading commit data...
debug Loading commit data...
encoding Loading commit data...
errors Loading commit data...
expvar Loading commit data...
flag Loading commit data...
fmt Loading commit data...
go Loading commit data...
hash Loading commit data...
html Loading commit data...
image Loading commit data...
index/suffixarray Loading commit data...
internal Loading commit data...
io Loading commit data...
log Loading commit data...
math Loading commit data...
mime Loading commit data...
net Loading commit data...
os Loading commit data...
path Loading commit data...
plugin Loading commit data...
reflect Loading commit data...
regexp Loading commit data...
runtime Loading commit data...
sort Loading commit data...
strconv Loading commit data...
strings Loading commit data...
sync Loading commit data...
syscall Loading commit data...
testing Loading commit data...
text Loading commit data...
time Loading commit data...
unicode Loading commit data...
unsafe Loading commit data...
vendor/golang_org/x Loading commit data...
Make.dist Loading commit data...
all.bash Loading commit data...
all.bat Loading commit data...
all.rc Loading commit data...
androidtest.bash Loading commit data...
bootstrap.bash Loading commit data...
buildall.bash Loading commit data...
clean.bash Loading commit data...
clean.bat Loading commit data...
clean.rc Loading commit data...
cmp.bash Loading commit data...
iostest.bash Loading commit data...
make.bash Loading commit data...
make.bat Loading commit data...
make.rc Loading commit data...
naclmake.bash Loading commit data...
nacltest.bash Loading commit data...
race.bash Loading commit data...
race.bat Loading commit data...
run.bash Loading commit data...
run.bat Loading commit data...
run.rc Loading commit data...