Skip to content

Commit

Permalink
pin golangci-lint version to latest available, fix reported errors
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal authored and umputun committed May 10, 2024
1 parent 6daa11a commit 17c5d43
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 32 deletions.
19 changes: 7 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,17 @@ jobs:
cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "mocks" | grep -v "_mock" > $GITHUB_WORKSPACE/profile.cov
working-directory: app
env:
GOFLAGS: "-mod=vendor"
TZ: "America/Chicago"

- name: install golangci-lint and goveralls
run: |
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $GITHUB_WORKSPACE v1.40.0
GO111MODULE=off go get -u github.com/mattn/goveralls
- name: run linters
run: $GITHUB_WORKSPACE/golangci-lint run
env:
GOFLAGS: "-mod=vendor"
TZ: "America/Chicago"
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.58

- name: submit coverage
run: $(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov
run: |
go install github.com/mattn/goveralls@latest
goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
24 changes: 7 additions & 17 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
run:
timeout: 5m
output:
format: tab
skip-dirs:
- vendor

linters-settings:
govet:
check-shadowing: true
golint:
min-confidence: 0.1
maligned:
suggest-new: true
enable:
- shadow
goconst:
min-len: 2
min-occurrences: 2
Expand All @@ -33,22 +26,17 @@ linters-settings:

linters:
enable:
- megacheck
- revive
- govet
- unconvert
- megacheck
- structcheck
- gas
- staticcheck
- gosec
- gocyclo
- dupl
- misspell
- unparam
- varcheck
- deadcode
- unused
- typecheck
- ineffassign
- varcheck
- stylecheck
- gochecknoinits
- exportloopref
Expand All @@ -60,6 +48,8 @@ linters:
disable-all: true

issues:
exclude-dirs:
- vendor
exclude-rules:
- text: "at least one file in a package should have a package comment"
linters:
Expand Down
6 changes: 3 additions & 3 deletions app/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestRest_taskCtrl(t *testing.T) {
return "echo " + name, true
}}

runner := &mocks.RunnerMock{RunFunc: func(ctx context.Context, command string, logWriter io.Writer) error {
runner := &mocks.RunnerMock{RunFunc: func(context.Context, string, io.Writer) error {
return nil
}}

Expand Down Expand Up @@ -66,7 +66,7 @@ func TestRest_taskCtrlAsync(t *testing.T) {
return "echo " + name, true
}}

runner := &mocks.RunnerMock{RunFunc: func(ctx context.Context, command string, logWriter io.Writer) error {
runner := &mocks.RunnerMock{RunFunc: func(context.Context, string, io.Writer) error {
time.Sleep(100 * time.Millisecond)
return nil
}}
Expand All @@ -89,7 +89,7 @@ func TestRest_taskPostCtrl(t *testing.T) {
return "echo " + name, true
}}

runner := &mocks.RunnerMock{RunFunc: func(ctx context.Context, command string, logWriter io.Writer) error {
runner := &mocks.RunnerMock{RunFunc: func(context.Context, string, io.Writer) error {
return nil
}}

Expand Down

0 comments on commit 17c5d43

Please sign in to comment.