-
-
Notifications
You must be signed in to change notification settings - Fork 980
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go vet and golint the project, release 3.1.5
- Loading branch information
Peter Kieltyka
committed
Aug 2, 2017
1 parent
394e5ca
commit 25354a5
Showing
10 changed files
with
96 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import ( | |
) | ||
|
||
var ( | ||
// RouteCtxKey is the context.Context key to store the request context. | ||
RouteCtxKey = &contextKey{"RouteContext"} | ||
) | ||
|
||
|
@@ -60,6 +61,8 @@ func (x *Context) reset() { | |
x.methodNotAllowed = false | ||
} | ||
|
||
// URLParam returns the corresponding URL parameter value from the request | ||
// routing context. | ||
func (x *Context) URLParam(key string) string { | ||
for k := len(x.URLParams.Keys) - 1; k >= 0; k-- { | ||
if x.URLParams.Keys[k] == key { | ||
|
@@ -110,6 +113,7 @@ func URLParamFromCtx(ctx context.Context, key string) string { | |
return "" | ||
} | ||
|
||
// RouteParams is a structure to track URL routing parameters efficiently. | ||
type RouteParams struct { | ||
Keys, Values []string | ||
} | ||
|
@@ -122,7 +126,7 @@ func (s *RouteParams) Add(key, value string) { | |
|
||
// ServerBaseContext wraps an http.Handler to set the request context to the | ||
// `baseCtx`. | ||
func ServerBaseContext(h http.Handler, baseCtx context.Context) http.Handler { | ||
func ServerBaseContext(baseCtx context.Context, h http.Handler) http.Handler { | ||
This comment has been minimized.
Sorry, something went wrong.
djui
|
||
fn := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
ctx := r.Context() | ||
baseCtx := baseCtx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Breaking API changes should happen on major releases only (v4.0.0). Or at least minor version (v3.2.0). Not sure if this is worthy just to satisfy golint :)
However,
ServerBaseContext()
isn't something many people use. Hopefully they won't be that mad at us :)