Skip to content

Commit 819f6c5

Browse files
committed
add comment
1 parent ce13dbf commit 819f6c5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

modules/session/mem.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ type mockMemRawStore struct {
1818
var _ session.RawStore = (*mockMemRawStore)(nil)
1919

2020
func (m *mockMemRawStore) Set(k, v any) error {
21+
// We need to use gob to encode the value, to make it have the same behavior as other stores and catch abuses.
22+
// Because gob needs to "Register" the type before it can encode it, and it's unable to decode a struct to "any" so use a map to help to decode the value.
2123
var buf bytes.Buffer
2224
if err := gob.NewEncoder(&buf).Encode(map[string]any{"v": v}); err != nil {
2325
return err

0 commit comments

Comments
 (0)