Skip to content

Commit

Permalink
Fix golangci-lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
coreydaley committed Jul 10, 2023
1 parent 60b2ba3 commit 8745abc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 0 additions & 2 deletions sessions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func TestFlashes(t *testing.T) {

req, _ = http.NewRequest("GET", "http://localhost:8080/", nil)
req.Header.Add("Cookie", cookies[0])
rsp = NewRecorder()
// Get a session.
if session, err = store.Get(req, "session-key"); err != nil {
t.Fatalf("Error getting session: %v", err)
Expand Down Expand Up @@ -135,7 +134,6 @@ func TestFlashes(t *testing.T) {

req, _ = http.NewRequest("GET", "http://localhost:8080/", nil)
req.Header.Add("Cookie", cookies[0])
rsp = NewRecorder()
// Get a session.
if session, err = store.Get(req, "session-key"); err != nil {
t.Fatalf("Error getting session: %v", err)
Expand Down
5 changes: 2 additions & 3 deletions store.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package sessions

import (
"encoding/base32"
"io/ioutil"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -261,15 +260,15 @@ func (s *FilesystemStore) save(session *Session) error {
filename := filepath.Join(s.path, "session_"+session.ID)
fileMutex.Lock()
defer fileMutex.Unlock()
return ioutil.WriteFile(filename, []byte(encoded), 0600)
return os.WriteFile(filename, []byte(encoded), 0600)
}

// load reads a file and decodes its content into session.Values.
func (s *FilesystemStore) load(session *Session) error {
filename := filepath.Join(s.path, "session_"+session.ID)
fileMutex.RLock()
defer fileMutex.RUnlock()
fdata, err := ioutil.ReadFile(filename)
fdata, err := os.ReadFile(filename)
if err != nil {
return err
}
Expand Down

0 comments on commit 8745abc

Please sign in to comment.