From 7bbea67ab55edc1d34dfbdcd2a6faa8987da0527 Mon Sep 17 00:00:00 2001 From: Austin Vazquez Date: Thu, 24 Nov 2022 15:29:42 +0000 Subject: [PATCH] Add golangci-lint to CI and resolve warnings Signed-off-by: Austin Vazquez --- .github/workflows/main.yml | 19 +++++++++++++++++++ .golangci.yml | 25 +++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .golangci.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5108090..4f5f60f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,6 +22,25 @@ jobs: with: working-directory: src/github.com/containerd/fuse-overlayfs-snapshotter + linters: + name: Linters + permissions: + contents: read # for actions/checkout to fetch code + pull-requests: read # for golangci/golangci-lint-action to fetch pull requests + runs-on: ubuntu-22.04 + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + with: + path: src/github.com/containerd/fuse-overlayfs-snapshotter + - uses: actions/setup-go@v5 + with: + go-version: 1.21.x + - uses: golangci/golangci-lint-action@v6 + with: + version: v1.63.4 + working-directory: src/github.com/containerd/fuse-overlayfs-snapshotter + test: runs-on: ubuntu-22.04 timeout-minutes: 30 diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..f296903 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,25 @@ +linters: + enable: + - copyloopvar + - depguard + - gofmt + - gosec + - govet + - ineffassign + - misspell + - nolintlint + - staticcheck + - tenv + - unconvert + - unused + disable: + - errcheck + - revive + +linters-settings: + depguard: + rules: + main: + deny: + - pkg: "io/ioutil" + desc: use "io" or "os" instead