-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy path.golangci.yml
53 lines (46 loc) · 2.25 KB
/
.golangci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# © 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:
exclude-rules:
# Exclude specific staticcheck rules to suppress false positives or acceptable issues.
- linters: [staticcheck]
text: "SA4004|SA1019|GetOkExists"
# Exclude specific gosec rules to suppress warnings about issues deemed acceptable.
- linters: [gosec]
text: "G402|G404|G115"
linters:
disable-all: true # Disable all linters by default and enable only the ones required.
enable:
- gofmt # Checks Go code formatting.
- goimports # Ensures proper import formatting.
- gosimple # Reports simplifications in code.
- govet # Examines code for possible mistakes.
- gosec # Checks for security issues in code.
- ineffassign # Detects inefficient assignments.
- misspell # Finds and fixes typos.
- staticcheck # Reports bugs, code smells, and deprecated practices.
- unused # Detects unused variables, constants, etc.
run:
deadline: 30m # Sets the maximum time limit for the linter run.
output:
formats:
- format: colored-line-number # Allows colored output with line numbers when errors are reported.
linters-settings:
errcheck:
# Exclude specific functions from errcheck warnings, as errors are intentionally ignored in these cases.
exclude-functions:
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set"
- "fmt:.*"
- "io:Close"
revive:
# Enable specific rules for the revive linter for improved code quality and readability.
rules:
- name: unreachable-code # Detect code that will never be executed.
- name: errorf # Avoid string formatting in error messages.
- name: range # Improve range loop usage.
- name: superfluous-else # Eliminate unnecessary else statements.
- name: var-declaration # Simplify variable declaration.
- name: duplicated-imports # Detect and remove duplicate imports.-imports