-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
gin.Context with fallback value from gin.Context.Request.Context() #2751
Conversation
Good!! I always use c.Request.Context(). |
@wei840222 Please rebase the master branch to trigger unit testing with GitHub Actions. |
hi @appleboy. I've rebased the master, plz check. |
delete more "()"
* ci: add github action workflows * test: fixed the TestUnixSocket test on windows (#20) * ci: add github action workflows (#18) * Remove .travis.yml * ci: replace GITTER_ROOM_ID and upload coverage every time you go test * ci: update coverage using codecov/codecov-action@v1 * Merge branch 'master' into github-actions * repo: replace travis ci to github actions * ci: add go version 1.16 * fix: go install requires a specific version * chore(ci): remove go 1.12 support * chore(ci): remove os windows-latest Co-authored-by: thinkerou <thinkerou@gmail.com> Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #2751 +/- ##
=======================================
Coverage 98.69% 98.70%
=======================================
Files 41 41
Lines 2072 2079 +7
=======================================
+ Hits 2045 2052 +7
Misses 15 15
Partials 12 12
Continue to review full report at Codecov.
|
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.
lgtm
@wei840222 @appleboy @thinkerou This may be break change, I always use c.Request.Context(), It can be cancel or timeout when I use middleware. We should Done() and Deadline(),Err() API fallback c.Request.Done(), c.Request.Deadline(),c.Request.Err() too ? |
This proposal is good, for the default impl in Context.Deadline() Context.Done() Context.Err() seems no actual behavior. |
please, thanks! |
Still not in any release? Maybe release as a 1.7.8? |
As said by @thinkgos, this change makes a break change #3166 |
For many tracing sdk
They will have SpanFromContext function. like:
https://github.com/opentracing/opentracing-go/blob/master/gocontext.go#L26
https://github.com/open-telemetry/opentelemetry-go/blob/main/trace/context.go#L48
And middleware sdk always put trace contenxt to http.Request.Context
https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go#L79
If gin.Context with fallback value from gin.Context.Request.Context(), it can be pass the gin.Context as context.Context to sub function call. It will be usefull.
can be