-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix confusing names #579
Fix confusing names #579
Conversation
For the record, #!/usr/bin/env fish
for pair in \
"FromHTTPContext ContextToHTTP" \
"ToHTTPContext HTTPToContext" \
"FromGRPCContext ContextToGRPC" \
"ToGRPCContext GRPCToContext" \
"FromHTTPRequest HTTPToContext" \
"ToHTTPRequest ContextToHTTP" \
"FromGRPCRequest GRPCToContext" \
"ToGRPCRequest ContextToGRPC"
set fr (echo $pair | awk '{print $1}')
set to (echo $pair | awk '{print $2}')
echo change from $fr to $to
find . -type f -name '*.go' -exec sed -i '' s/$fr/$to/ \{\} + # macOS syntax
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good. I think the docs have some broken grammar.
auth/jwt/transport.go
Outdated
@@ -17,9 +17,9 @@ const ( | |||
bearerFormat string = "Bearer %s" | |||
) | |||
|
|||
// ToHTTPContext moves JWT token from request header to context. Particularly | |||
// HTTPToContext moves JWT token from request header to context. Particularly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel obligated to point out that JWT is an acronym for JSON Web Token, which makes the phrase "JWT token" repetitive. I believe a more grammatically correct phrasing is "... moves a JWT from request header to context."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thank you.
@@ -17,9 +17,9 @@ const ( | |||
bearerFormat string = "Bearer %s" | |||
) | |||
|
|||
// ToHTTPContext moves JWT token from request header to context. Particularly | |||
// HTTPToContext moves a JWT from request header to context. Particularly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "a" article use is now inconsistent (present with "JWT", absent with "request header" and "context"), not sure if that's intentional, not a big deal.
// useful for servers. | ||
func ToHTTPContext() http.RequestFunc { | ||
func HTTPToContext() http.RequestFunc { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Context" seems to be in all of these names, so is it redundant? Would To/FromHTTP and To/FromGRPC be equally clear? I haven't taken a close look at the whole file, and I've never used the package, so I'm genuinely asking. :) If not, the names look good!
Fix confusing names
Closes #526.
@ChrisHines @basvanbeek — interested in a review?
@willfaught @terinjokes — likewise, and FYI.