Skip to content

Commit 3505023

Browse files
committed
feat(deps): bump golangci-lint CI version
1 parent 5f2328c commit 3505023

5 files changed

Lines changed: 31 additions & 28 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ jobs:
1717
# The Windows build currently fail because of https://github.com/golang/go/issues/40795, and because xcaddy isn't compatible with the known workaround
1818
#os: [ ubuntu-latest, macos-latest, windows-latest ]
1919
os: [ ubuntu-latest, macos-latest ]
20-
go: [ '1.21' ]
20+
go: [ '1.24' ]
2121

2222
runs-on: ${{ matrix.os }}
2323

2424
steps:
2525
- name: Install Go
26-
uses: actions/setup-go@v4
26+
uses: actions/setup-go@v5
2727
with:
2828
go-version: ${{ matrix.go }}
2929

3030
- name: Checkout code
31-
uses: actions/checkout@v3
31+
uses: actions/checkout@v4
3232

3333
- name: Print Go version and environment
3434
id: vars
@@ -44,7 +44,7 @@ jobs:
4444
echo "::set-output name=go_cache::$(go env GOCACHE)"
4545
4646
- name: Cache the build cache
47-
uses: actions/cache@v2
47+
uses: actions/cache@v4
4848
with:
4949
path: ${{ steps.vars.outputs.go_cache }}
5050
key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }}
@@ -71,11 +71,11 @@ jobs:
7171
runs-on: ubuntu-latest
7272

7373
steps:
74-
- uses: actions/checkout@v3
75-
- uses: actions/setup-go@v4
74+
- uses: actions/checkout@v4
75+
- uses: actions/setup-go@v5
7676
with:
77-
go-version: '1.21'
77+
go-version: '1.24'
7878
- name: golangci-lint
79-
uses: golangci/golangci-lint-action@v3
79+
uses: golangci/golangci-lint-action@v8
8080
with:
8181
args: --timeout 5m

cleaner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ func newStorageProvider() *storage_providers {
2121
}
2222

2323
func (s *storage_providers) Add(key interface{}) {
24-
s.RWMutex.Lock()
25-
defer s.RWMutex.Unlock()
24+
s.Lock()
25+
defer s.Unlock()
2626

2727
s.list[key] = true
2828
}

configuration.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,12 @@ func parseRedisConfiguration(c map[string]interface{}) map[string]interface{} {
321321
case "SendToReplicas", "ShuffleInit", "ClientNoTouch", "DisableRetry", "DisableCache", "AlwaysPipelining", "AlwaysRESP2", "ForceSingleClient", "ReplicaOnly", "ClientNoEvict", "ContextTimeoutEnabled", "PoolFIFO", "ReadOnly", "RouteByLatency", "RouteRandomly", "DisableIndentity":
322322
c[k] = true
323323
case "SelectDB", "CacheSizeEachConn", "RingScaleEachConn", "ReadBufferEachConn", "WriteBufferEachConn", "BlockingPoolSize", "PipelineMultiplex", "DB", "Protocol", "MaxRetries", "PoolSize", "MinIdleConns", "MaxIdleConns", "MaxActiveConns", "MaxRedirects":
324-
if v == false {
324+
switch v {
325+
case false:
325326
c[k] = 0
326-
} else if v == true {
327+
case true:
327328
c[k] = 1
328-
} else {
329+
default:
329330
c[k], _ = strconv.Atoi(v.(string))
330331
}
331332
case "ConnWriteTimeout", "MaxFlushDelay", "MinRetryBackoff", "MaxRetryBackoff", "DialTimeout", "ReadTimeout", "WriteTimeout", "PoolTimeout", "ConnMaxIdleTime", "ConnMaxLifetime":
@@ -362,19 +363,21 @@ func parseSimpleFSConfiguration(c map[string]interface{}) map[string]interface{}
362363
case "path":
363364
c[k] = v
364365
case "size":
365-
if v == false {
366+
switch v {
367+
case false:
366368
c[k] = 0
367-
} else if v == true {
369+
case true:
368370
c[k] = 1
369-
} else {
371+
default:
370372
c[k], _ = strconv.Atoi(v.(string))
371373
}
372374
case "directory_size":
373-
if v == false {
375+
switch v {
376+
case false:
374377
c[k] = 0
375-
} else if v == true {
378+
case true:
376379
c[k] = 1
377-
} else {
380+
default:
378381
c[k], _ = strconv.Atoi(v.(string))
379382
}
380383
}

httpcache.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,16 @@ func (s *SouinCaddyMiddleware) FromApp(app *SouinApp) error {
136136
}
137137
}
138138

139-
if app.DefaultCache.GetTTL() == 0 {
139+
if app.GetTTL() == 0 {
140140
if s.Configuration.DefaultCache.GetTTL() == 0 {
141-
app.DefaultCache.TTL = configurationtypes.Duration{Duration: 120 * time.Second}
141+
app.TTL = configurationtypes.Duration{Duration: 120 * time.Second}
142142
}
143143
}
144144

145145
if s.Configuration.GetDefaultCache() == nil {
146146
s.Configuration.DefaultCache = DefaultCache{
147-
AllowedHTTPVerbs: app.DefaultCache.AllowedHTTPVerbs,
148-
AllowedAdditionalStatusCodes: app.DefaultCache.AllowedAdditionalStatusCodes,
147+
AllowedHTTPVerbs: app.AllowedHTTPVerbs,
148+
AllowedAdditionalStatusCodes: app.AllowedAdditionalStatusCodes,
149149
Headers: app.Headers,
150150
Key: app.Key,
151151
TTL: app.TTL,
@@ -156,7 +156,7 @@ func (s *SouinCaddyMiddleware) FromApp(app *SouinApp) error {
156156
}
157157
return nil
158158
}
159-
if s.Configuration.CacheKeys == nil || len(s.Configuration.CacheKeys) == 0 {
159+
if len(s.Configuration.CacheKeys) == 0 {
160160
s.Configuration.CacheKeys = configurationtypes.CacheKeys{}
161161
}
162162
if s.CacheKeys == nil {
@@ -175,7 +175,7 @@ func (s *SouinCaddyMiddleware) FromApp(app *SouinApp) error {
175175
appDc := app.DefaultCache
176176
s.Configuration.DefaultCache.AllowedHTTPVerbs = append(s.Configuration.DefaultCache.AllowedHTTPVerbs, appDc.AllowedHTTPVerbs...)
177177
s.Configuration.DefaultCache.AllowedAdditionalStatusCodes = append(s.Configuration.DefaultCache.AllowedAdditionalStatusCodes, appDc.AllowedAdditionalStatusCodes...)
178-
s.Configuration.DefaultCache.CDN = app.DefaultCache.CDN
178+
s.Configuration.DefaultCache.CDN = app.CDN
179179
if dc.Headers == nil {
180180
s.Configuration.DefaultCache.Headers = appDc.Headers
181181
}
@@ -278,9 +278,9 @@ func (s *SouinCaddyMiddleware) Provision(ctx caddy.Context) error {
278278
}
279279

280280
if app.SurrogateStorage == (surrogates_providers.SurrogateInterface)(nil) {
281-
app.SurrogateStorage = s.SouinBaseHandler.SurrogateKeyStorer
281+
app.SurrogateStorage = s.SurrogateKeyStorer
282282
} else {
283-
s.SouinBaseHandler.SurrogateKeyStorer = app.SurrogateStorage
283+
s.SurrogateKeyStorer = app.SurrogateStorage
284284
}
285285

286286
return nil

httpcache_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ func (t *testVaryHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
820820
w.Header().Set("Vary", variedHeader)
821821
w.Header().Set(variedHeader, r.Header.Get(variedHeader))
822822
w.WriteHeader(http.StatusOK)
823-
_, _ = w.Write([]byte(fmt.Sprintf("Hello, vary %s!", r.Header.Get(variedHeader))))
823+
_, _ = fmt.Fprintf(w, "Hello, vary %s!", r.Header.Get(variedHeader))
824824
}
825825

826826
func TestVaryHandler(t *testing.T) {

0 commit comments

Comments
 (0)