Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin golangci-lint version to latest available, fix reported errors #24

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading