aboutsummaryrefslogtreecommitdiff
path: root/securecookie.go
diff options
context:
space:
mode:
authorAbdülhamit Yilmaz <mr.yilmaz@gmx.de>2015-03-18 01:33:39 +0300
committerAbdülhamit Yilmaz <mr.yilmaz@gmx.de>2015-03-18 01:33:39 +0300
commitc7a729999d0c3e51964bd30c05547fac82f6527d (patch)
tree99c8a275cceaecdd0bc25973347ee2cba9959898 /securecookie.go
parent1be1b717b743c89f2393561985403b51bc192255 (diff)
Commenting retErr and setErr in Decode
Diffstat (limited to 'securecookie.go')
-rw-r--r--securecookie.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/securecookie.go b/securecookie.go
index a96deb1..2509608 100644
--- a/securecookie.go
+++ b/securecookie.go
@@ -177,7 +177,12 @@ func (s *SecureCookie) Encode(name string, value interface{}) (string, error) {
// it was stored. The value argument is the encoded cookie value. The dst
// argument is where the cookie will be decoded. It must be a pointer.
func (s *SecureCookie) Decode(name, value string, dst interface{}) error {
+ // retErr is the error which will be returned.
+ // It will be the first error that will occur (if any).
var retErr error
+
+ // setErr saves the error only if there was no previous error.
+ // Otherwise retErr would be overwritten by subsequent errors.
setErr := func(err error) {
if retErr == nil {
retErr = err