From 453021d9ff40e03bcced6053e89ebe6c8338620d Mon Sep 17 00:00:00 2001 From: Gwendal Leclerc Date: Mon, 2 Oct 2023 20:26:23 +0200 Subject: [PATCH] fix: golang-ci-lint version + lint errors --- Makefile | 2 +- server/services/persistence.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index dd24027..2704734 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ REFLEX=$(GOPATH)/bin/reflex $(REFLEX): go install github.com/cespare/reflex@latest -GOLANGCILINTVERSION:=1.32.0 +GOLANGCILINTVERSION:=1.54.2 GOLANGCILINT=$(GOPATH)/bin/golangci-lint $(GOLANGCILINT): curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v$(GOLANGCILINTVERSION) diff --git a/server/services/persistence.go b/server/services/persistence.go index e6c720f..bca829c 100644 --- a/server/services/persistence.go +++ b/server/services/persistence.go @@ -110,6 +110,7 @@ func (p *persistence) StoreSessions(sessions types.Sessions) { } var sessionsGroup errgroup.Group for _, session := range sessions { + session := session sessionsGroup.Go(func() error { if err := p.createSessionDirectory(session.ID); err != nil { return err @@ -161,6 +162,7 @@ func (p *persistence) LoadSessions() (types.Sessions, error) { var sessionsGroup errgroup.Group var sessionsLock sync.Mutex for _, session := range sessions { + session := session sessionsGroup.Go(func() error { historyFile, err := os.Open(filepath.Join(p.persistenceDirectory, session.ID, historyFileName)) if err != nil { @@ -235,7 +237,6 @@ func (p *persistence) persistHistory(sessionID string, h types.History) error { } func (p *persistence) persistMocks(sessionID string, m types.Mocks) error { - // we need to reverse mocks before storage in order to have a reusable mocks file as mocks are stored as a stack orderedMocks := make(types.Mocks, 0, len(m)) for i := len(m) - 1; i >= 0; i-- {