Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Gorilla Sessions and Maps
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
jackman  
View profile  
 More options Oct 9 2012, 11:14 am
From: jackman <kd7...@gmail.com>
Date: Tue, 9 Oct 2012 08:14:28 -0700 (PDT)
Local: Tues, Oct 9 2012 11:14 am
Subject: Gorilla Sessions and Maps

Here is the code about which I speak:
http://pastebin.com/wSBfMAfN

The problem I am experiencing is that when I try to store a map into the
session, I get the following error:
securecookie: the value could not be encoded

The map I'm trying to assign to the session is as follows (with "%#v"):
map[string]int{"073366118239":1, "073366118238":2}

I've been beating my head against the wall trying to figure out why this
isn't working now, but it was earlier. I even have residual session data in
the same session. The only thing that I've changed recently is this line:
cart := make(map[string]int) // map[UPC]Quantity

It was originally just the following:
var cart map[string]int

Go was complaining about making assignments to a nil map.

I haven't changed the CookieStore key.

Here is the complete handler:
http://pastebin.com/bP6SvFRM

Thanks for all your help!

Andrew Jackman.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kamil Kisiel  
View profile  
 More options Oct 9 2012, 2:35 pm
From: Kamil Kisiel <kamil.kis...@gmail.com>
Date: Tue, 9 Oct 2012 11:35:21 -0700 (PDT)
Local: Tues, Oct 9 2012 2:35 pm
Subject: Re: Gorilla Sessions and Maps

Session uses securecookie to encode values in to the session. securecookie
uses gob under the hood, the actual error is that your map type is not
registered with gob.

You need to make a function like:

func init() {
    gob.Register(map[string]int{})

}

in your package to register your type with Gob. Unfortunately the reason it
failed is unclear because
of https://github.com/gorilla/securecookie/issues/1

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jackman  
View profile  
 More options Oct 10 2012, 7:01 am
From: jackman <kd7...@gmail.com>
Date: Wed, 10 Oct 2012 04:01:11 -0700 (PDT)
Local: Wed, Oct 10 2012 7:01 am
Subject: Re: Gorilla Sessions and Maps

May the Gods of Code smile kindly upon you, sir!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rodrigo Moraes  
View profile  
 More options Oct 13 2012, 4:32 am
From: Rodrigo Moraes <rodrigo.mor...@gmail.com>
Date: Sat, 13 Oct 2012 01:32:55 -0700 (PDT)
Local: Sat, Oct 13 2012 4:32 am
Subject: Re: Gorilla Sessions and Maps
On Oct 9, 3:35 pm, Kamil Kisiel wrote:

> Unfortunately the reason it
> failed is unclear because
> of https://github.com/gorilla/securecookie/issues/1

Just closed it. This has been a common cause of confusion since
beginning. :)

-- rodrigo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »