diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 13be108..3837d50 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -2,22 +2,32 @@ name: golangci-lint on: pull_request: + paths-ignore: + - 'README.md' + push: + paths-ignore: + - 'README.md' + +permissions: + contents: read jobs: - golint: - name: golint + build: + name: Build runs-on: ubuntu-latest + timeout-minutes: 5 steps: - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Setup Go + uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 with: go-version-file: 'go.mod' - - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + cache: true + - run: go mod download + - run: go build -v . + - name: Run Linters + uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 with: version: v1.60.3 args: --issues-exit-code=1 diff --git a/.golangci.yml b/.golangci.yml index 244639a..82e78b4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,21 @@ +# © Broadcom. All Rights Reserved. +# The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. +# SPDX-License-Identifier: MPL-2.0 + +# For more information about the golangci-lint configuration file, refer to: +# https://golangci-lint.run/usage/configuration/ + issues: max-per-linter: 0 max-same-issues: 0 + exclude-rules: + # Exclude errcheck for some rules. + - linters: [errcheck] + text: "Error return value of `d.Set` is not checked" + # Exclude revive for some rules. + - linters: + - revive + text: 'redefines-builtin-id: redefinition of the built-in' run: deadline: 5m @@ -28,4 +43,7 @@ linters: linters-settings: errcheck: - ignore: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set,fmt:.*,io:Close + exclude-functions: + - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set" + - "fmt:.*" + - "io:Close"