Skip to content
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

Stopped outdated error from being returned #251

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions cookie.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !go1.11
// +build !go1.11

package sessions
Expand Down
1 change: 1 addition & 0 deletions cookie_go111.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build go1.11
// +build go1.11

package sessions
Expand Down
1 change: 1 addition & 0 deletions cookie_go111_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build go1.11
// +build go1.11

package sessions
Expand Down
1 change: 1 addition & 0 deletions options.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !go1.11
// +build !go1.11

package sessions
Expand Down
1 change: 1 addition & 0 deletions options_go111.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build go1.11
// +build go1.11

package sessions
Expand Down
9 changes: 4 additions & 5 deletions sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ func (s *Session) Store() Store {

// sessionInfo stores a session tracked by the registry.
type sessionInfo struct {
s *Session
e error
*Session
}

// contextKey is the type used to store the registry in the context.
Expand Down Expand Up @@ -134,11 +133,11 @@ func (s *Registry) Get(store Store, name string) (session *Session, err error) {
return nil, fmt.Errorf("sessions: invalid character in cookie name: %s", name)
}
if info, ok := s.sessions[name]; ok {
session, err = info.s, info.e
fednelpat marked this conversation as resolved.
Show resolved Hide resolved
session, err = info.Session, nil
} else {
session, err = store.New(s.request, name)
session.name = name
s.sessions[name] = sessionInfo{s: session, e: err}
s.sessions[name] = sessionInfo{session}
}
session.store = store
return
Expand All @@ -148,7 +147,7 @@ func (s *Registry) Get(store Store, name string) (session *Session, err error) {
func (s *Registry) Save(w http.ResponseWriter) error {
var errMulti MultiError
for name, info := range s.sessions {
session := info.s
session := info.Session
if session.store == nil {
errMulti = append(errMulti, fmt.Errorf(
"sessions: missing store for session %q", name))
Expand Down