diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8f2cb4c9d..bce99d7af 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -57,3 +57,8 @@ current development landscape. - We follow the [Effective Go](https://golang.org/doc/effective_go) guidelines. Please make sure your code is idiomatic and follows the guidelines. + +### Code Linting + +- We employ `golangci-lint` for code linting in our development process. It ensures that code adheres to established standards, and any changes that do not pass the linting checks will trigger an error during the Continuous Integration (CI) process. +- You can run it locally by installing the `golangci-lint` binary and running `golangci-lint run` in the root directory of the repository. diff --git a/.github/workflows/lint-go.yaml b/.github/workflows/lint-go.yaml new file mode 100644 index 000000000..bdea07482 --- /dev/null +++ b/.github/workflows/lint-go.yaml @@ -0,0 +1,30 @@ +name: Lint + +on: + push: + branches: + - master + pull_request: + +permissions: + contents: read + +jobs: + golangci: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.21' + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54 + args: --timeout=30m + only-new-issues: true + skip-cache: true + skip-pkg-cache: true + skip-build-cache: true diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 000000000..d0cc50c43 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,19 @@ +# Please refer to the official golangci-lint config documentation for more details: +# https://golangci-lint.run/usage/configuration/ +# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml + +linters: + enable-all: true + +linters-settings: + gci: + sections: + - standard + - default + +run: + timeout: 10m + tests: false + +issues: + max-issues-per-linter: 1000