Skip to content

Commit 7ba0b4e

Browse files
committed
fix CI workflow caching by reordering checkout and setup-go steps
- move checkout step before setup-go to enable proper Go module caching - update actions/checkout to v4 and actions/setup-go to v5 - update golangci-lint-action to v7 with version v2.6 - migrate golangci-lint config from v1 to v2 format - fix deprecated comment format for FileServer and FileServerSPA - remove obsolete golint nolint directive
1 parent c1e001f commit 7ba0b4e

4 files changed

Lines changed: 61 additions & 62 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14+
- name: checkout
15+
uses: actions/checkout@v4
16+
1417
- name: set up go
1518
uses: actions/setup-go@v5
1619
with:
1720
go-version: "1.23"
1821
id: go
1922

20-
- name: checkout
21-
uses: actions/checkout@v4
22-
2323
- name: build and test
2424
run: |
2525
go get -v
@@ -31,9 +31,9 @@ jobs:
3131
TZ: "America/Chicago"
3232

3333
- name: golangci-lint
34-
uses: golangci/golangci-lint-action@v6
34+
uses: golangci/golangci-lint-action@v7
3535
with:
36-
version: v1.64
36+
version: latest
3737

3838
- name: install goveralls
3939
run: |
@@ -42,4 +42,4 @@ jobs:
4242
- name: submit coverage
4343
run: $(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov
4444
env:
45-
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.golangci.yml

Lines changed: 52 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,63 @@
1+
version: "2"
12
run:
23
timeout: 5m
34
tests: false
4-
5-
linters-settings:
6-
govet:
7-
enable:
8-
- shadow
9-
goconst:
10-
min-len: 2
11-
min-occurrences: 2
12-
misspell:
13-
locale: US
14-
lll:
15-
line-length: 140
16-
gocritic:
17-
enabled-tags:
18-
- performance
19-
- style
20-
- experimental
21-
disabled-checks:
22-
- wrapperFunc
23-
- hugeParam
24-
- rangeValCopy
25-
- singleCaseSwitch
26-
- ifElseChain
27-
5+
concurrency: 4
286
linters:
7+
default: none
298
enable:
30-
- revive
31-
- govet
32-
- unconvert
33-
- staticcheck
34-
- unused
35-
- gosec
369
- dupl
37-
- misspell
38-
- unparam
39-
- typecheck
40-
- ineffassign
41-
- stylecheck
4210
- gochecknoinits
43-
- copyloopvar
4411
- gocritic
12+
- govet
13+
- ineffassign
14+
- misspell
4515
- nakedret
46-
- gosimple
4716
- prealloc
48-
fast: false
49-
disable-all: true
50-
51-
issues:
52-
exclude-dirs:
53-
- vendor
54-
exclude-rules:
55-
- text: "at least one file in a package should have a package comment"
56-
linters:
57-
- stylecheck
58-
- text: "should have a package comment"
59-
linters:
60-
- revive
61-
- path: _test\.go
62-
linters:
63-
- gosec
64-
- dupl
65-
exclude-use-default: false
17+
- revive
18+
- staticcheck
19+
- unconvert
20+
- unparam
21+
- unused
22+
settings:
23+
goconst:
24+
min-len: 2
25+
min-occurrences: 2
26+
gocritic:
27+
disabled-checks:
28+
- wrapperFunc
29+
- hugeParam
30+
- rangeValCopy
31+
- singleCaseSwitch
32+
- ifElseChain
33+
enabled-tags:
34+
- performance
35+
- style
36+
- experimental
37+
govet:
38+
enable-all: true
39+
disable:
40+
- fieldalignment
41+
lll:
42+
line-length: 140
43+
misspell:
44+
locale: US
6645

46+
exclusions:
47+
generated: lax
48+
rules:
49+
- linters:
50+
- staticcheck
51+
text: "at least one file in a package should have a package comment"
52+
- linters:
53+
- revive
54+
text: "should have a package comment"
55+
- linters:
56+
- gosec
57+
- dupl
58+
path: _test\.go
59+
paths:
60+
- vendor
61+
- third_party$
62+
- builtin$
63+
- examples$

file_server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@ func NewFileServer(public, local string, options ...FsOpt) (*FS, error) {
6868
}
6969

7070
// FileServer is a shortcut for making FS with listing disabled and the custom noFound reader (can be nil).
71+
//
7172
// Deprecated: the method is for back-compatibility only and user should use the universal NewFileServer instead
7273
func FileServer(public, local string, notFound io.Reader) (http.Handler, error) {
7374
return NewFileServer(public, local, FsOptCustom404(notFound))
7475
}
7576

7677
// FileServerSPA is a shortcut for making FS with SPA-friendly handling of 404, listing disabled and the custom noFound reader (can be nil).
78+
//
7779
// Deprecated: the method is for back-compatibility only and user should use the universal NewFileServer instead
7880
func FileServerSPA(public, local string, notFound io.Reader) (http.Handler, error) {
7981
return NewFileServer(public, local, FsOptCustom404(notFound), FsOptSPA)

logger/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,5 +355,5 @@ func (c *customResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
355355
if hj, ok := c.ResponseWriter.(http.Hijacker); ok {
356356
return hj.Hijack()
357357
}
358-
return nil, nil, fmt.Errorf("ResponseWriter does not implement the Hijacker interface") //nolint:golint //capital letter is OK here
358+
return nil, nil, fmt.Errorf("ResponseWriter does not implement the Hijacker interface")
359359
}

0 commit comments

Comments
 (0)