Added _ = to indicate there is a return from Save#197
Merged
elithrar merged 3 commits intogorilla:masterfrom Sep 17, 2019
Merged
Added _ = to indicate there is a return from Save#197elithrar merged 3 commits intogorilla:masterfrom
elithrar merged 3 commits intogorilla:masterfrom
Conversation
This is because I copied the sample and failed to notice there was a return, which for me was failing, and lost a bunch of time to troubleshooting.
Indicated the need for error handling so developer who copy samples get the indication that error handling is required. ( I was learning/tinkering and copied a sample without error handling, failed to notice that Save returns an error in the documentation, and it took me a lot of time/troubleshooting to track down the problem.)
Contributor
Author
|
Used _ = in the README.md (so as not to clutter / obscure the message) and "error =" & "if error != nil" in the docs.go to be more explicit. |
|
This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days. |
elithrar
suggested changes
Sep 8, 2019
README.md
Outdated
| session.Values[42] = 43 | ||
| // Save it before we write to the response/return from the handler. | ||
| session.Save(r, w) | ||
| _ = session.Save(r, w) |
Contributor
There was a problem hiding this comment.
Handle the error - e.g. if the session save fails, log it.
Contributor
Author
|
@elithrar Thanks for the feedback/change request. I was attempting to be consistent with the use of "_" in error handling a few lines above, but I've made a change to match your change request. I didn't log so much as return the HTTP internal error, as I found in other places in the Gorilla Sessions documentation. If you want just logging instead I can do that. |
elithrar
approved these changes
Sep 17, 2019
Contributor
|
Thanks! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is because I copied the sample and failed to notice there was a return, which for me was failing, and lost a bunch of time to troubleshooting. (Note: I actually copied the samples from here - https://www.gorillatoolkit.org/pkg/sessions - but don't know how to update that page.)
Fixes #
Summary of Changes