From b17cf559e6c64b89defec6351ae3a7bf135c1397 Mon Sep 17 00:00:00 2001 From: Andriy Biletsky Date: Tue, 30 Jan 2024 19:29:03 +0700 Subject: [PATCH] Add golangci-lint and vulncheck --- .github/workflows/golangci-lint.yml | 32 +++++++++++++++++++++++++++++ .github/workflows/test-release.yml | 5 +---- .golangci.yml | 31 ++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .golangci.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 00000000..47963edb --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,32 @@ +name: golangci-lint +on: + push: + branches: + - master + - dev + pull_request: + +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-go@v4 + with: + go-version: '1.20.x' + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + # only-new-issues: true + - id: govulncheck + uses: golang/govulncheck-action@v1 diff --git a/.github/workflows/test-release.yml b/.github/workflows/test-release.yml index ff1f7ef4..2f45b214 100644 --- a/.github/workflows/test-release.yml +++ b/.github/workflows/test-release.yml @@ -19,7 +19,7 @@ jobs: with: fetch-depth: 0 - uses: FedericoCarboni/setup-ffmpeg@v2 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.20.x' id: go @@ -46,9 +46,6 @@ jobs: - name: Check running containers run: docker ps -a - - name: Run go vet - run: go vet ./... - - name: Prepare for tests run: make prepare_test diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..12c44908 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,31 @@ +linters-settings: + errcheck: + check-type-assertions: true + goconst: + min-len: 2 + min-occurrences: 3 + +linters: + disable-all: true + enable: + - dupl + - gocritic + - goconst + - gocyclo + - gofmt + - goimports + - gosimple + - govet + - gosec + - ineffassign + - misspell + - staticcheck + - sqlclosecheck + - unused + +run: + timeout: 10m + +issues: + # Show only new issues created after git revision: 02270a6 + new-from-rev: d108866