From 924a7b7605e29ee65c630ce678cd2f59ae74c56e Mon Sep 17 00:00:00 2001 From: Ayooluwa Isaiah Date: Sat, 5 Oct 2024 18:05:24 +0100 Subject: [PATCH] add golangci-lint workflow --- .github/workflows/golangci-lint.yml | 23 +++++++++++++++++++++++ .golangci.yml | 3 ++- justfile | 4 ++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/golangci-lint.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..d62c2a5 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,23 @@ +name: Lint code +on: + push: + branches: + - master + pull_request: + +permissions: + contents: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 1.23 + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.60 diff --git a/.golangci.yml b/.golangci.yml index 14fe3c7..097db64 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,13 +6,13 @@ linters: - decorder - containedctx - contextcheck + - copyloopvar - dogsled - dupl - errcheck - errchkjson - errname - errorlint - - exportloopref - exhaustive - goconst - godot @@ -47,6 +47,7 @@ linters: - usestdlibvars - unparam - unused + - wastedassign - whitespace - wsl diff --git a/justfile b/justfile index d3c0689..838e9a0 100644 --- a/justfile +++ b/justfile @@ -23,6 +23,10 @@ build-win: lint: @golangci-lint run ./... +[no-cd] +lint-pkg: + @golangci-lint run ./... + pre-commit: @pre-commit run