Skip to content

Commit

Permalink
chore(gh): update golangci-lint workflow
Browse files Browse the repository at this point in the history
- Updates `golangci-lint` configuration.
- Updates the GitHub Action for `golangci-lint`.
- Pin GitHub Actions to release commit SHA.

Signed-off-by: Ryan Johnson <[email protected]>
  • Loading branch information
tenthirtyam committed Nov 19, 2024
1 parent 33e482f commit bc0e472
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
28 changes: 19 additions & 9 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 19 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -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 function new'

run:
deadline: 5m
Expand Down Expand Up @@ -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"

0 comments on commit bc0e472

Please sign in to comment.