Skip to content

Commit 5414a53

Browse files
committed
fix: refactor linting and session handling in Go codebase
- Update golangci-lint-action from v6 to v7 in GitHub workflow - Change golangci-lint version to v2.0 and remove timeout argument - Fix assignment of session options in gorm.go - Reorder return values in GetRedisStore function and update return statements in redis.go Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
1 parent 638c28d commit 5414a53

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
ref: ${{ github.ref }}
2727

2828
- name: golangci-lint
29-
uses: golangci/golangci-lint-action@v6
29+
uses: golangci/golangci-lint-action@v7
3030
with:
31-
version: latest
32-
args: --verbose --timeout 10m
31+
version: v2.0
32+
args: --verbose

gorm/gorm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ type store struct {
2626
}
2727

2828
func (s *store) Options(options sessions.Options) {
29-
s.Store.SessionOpts = options.ToGorillaOptions()
29+
s.SessionOpts = options.ToGorillaOptions()
3030
}

redis/redis.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ type store struct {
8888
// Returns:
8989
// - err: An error if the provided Store is not of the expected type.
9090
// - rediStore: The retrieved Redis store, or nil if there was an error.
91-
func GetRedisStore(s Store) (err error, rediStore *redistore.RediStore) {
91+
func GetRedisStore(s Store) (rediStore *redistore.RediStore, err error) {
9292
realStore, ok := s.(*store)
9393
if !ok {
9494
err = errors.New("unable to get the redis store: Store isn't *store")
95-
return
95+
return nil, err
9696
}
9797

9898
rediStore = realStore.RediStore
99-
return
99+
return rediStore, nil
100100
}
101101

102102
// SetKeyPrefix sets a key prefix for the given Redis store.
@@ -110,7 +110,7 @@ func GetRedisStore(s Store) (err error, rediStore *redistore.RediStore) {
110110
// Returns:
111111
// - error: An error if there is an issue retrieving the Redis store, otherwise nil.
112112
func SetKeyPrefix(s Store, prefix string) error {
113-
err, rediStore := GetRedisStore(s)
113+
rediStore, err := GetRedisStore(s)
114114
if err != nil {
115115
return err
116116
}

0 commit comments

Comments
 (0)