2023-03-28 20:12:41 +00:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
# SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 20:12:41 +00:00
|
|
|
|
2020-03-12 01:18:03 +00:00
|
|
|
linters:
|
|
|
|
disable-all: true
|
|
|
|
enable:
|
|
|
|
- gofmt
|
|
|
|
- govet
|
2020-04-16 17:35:28 +00:00
|
|
|
- unconvert
|
2020-05-14 21:02:52 +00:00
|
|
|
- staticcheck
|
2020-06-05 22:08:30 +00:00
|
|
|
- ineffassign
|
2020-06-23 17:43:24 +00:00
|
|
|
- unparam
|
2022-01-20 17:36:29 +00:00
|
|
|
- forbidigo
|
2022-09-02 16:56:40 +00:00
|
|
|
- gomodguard
|
|
|
|
- depguard
|
2020-03-12 01:18:03 +00:00
|
|
|
|
|
|
|
issues:
|
|
|
|
# Disable the default exclude list so that all excludes are explicitly
|
|
|
|
# defined in this file.
|
|
|
|
exclude-use-default: false
|
|
|
|
|
2020-05-14 21:02:52 +00:00
|
|
|
exclude-rules:
|
|
|
|
# Temp Ignore SA9004: only the first constant in this group has an explicit type
|
|
|
|
# https://staticcheck.io/docs/checks#SA9004
|
|
|
|
- linters: [staticcheck]
|
2023-04-28 17:14:37 +00:00
|
|
|
text: "SA9004:"
|
2022-05-25 01:44:54 +00:00
|
|
|
|
2022-10-24 16:33:22 +00:00
|
|
|
- linters: [staticcheck]
|
|
|
|
text: 'SA1019: "io/ioutil" has been deprecated since Go 1.16'
|
|
|
|
|
2020-06-23 17:43:24 +00:00
|
|
|
# An argument that always receives the same value is often not a problem.
|
|
|
|
- linters: [unparam]
|
2023-04-28 17:14:37 +00:00
|
|
|
text: "always receives"
|
2020-06-23 17:43:24 +00:00
|
|
|
|
|
|
|
# Often functions will implement an interface that returns an error without
|
|
|
|
# needing to return an error. Sometimes the error return value is unnecessary
|
|
|
|
# but a linter can not tell the difference.
|
|
|
|
- linters: [unparam]
|
|
|
|
text: 'result \d+ \(error\) is always nil'
|
|
|
|
|
|
|
|
# Allow unused parameters to start with an underscore. Arguments with a name
|
|
|
|
# of '_' are already ignored.
|
|
|
|
# Ignoring longer names that start with underscore allow for better
|
|
|
|
# self-documentation than a single underscore by itself. Underscore arguments
|
|
|
|
# should generally only be used when a function is implementing an interface.
|
|
|
|
- linters: [unparam]
|
2023-04-28 17:14:37 +00:00
|
|
|
text: "`_[^`]*` is unused"
|
2020-06-23 17:43:24 +00:00
|
|
|
|
|
|
|
# Temp ignore some common unused parameters so that unparam can be added
|
|
|
|
# incrementally.
|
|
|
|
- linters: [unparam]
|
2023-04-28 17:14:37 +00:00
|
|
|
text: "`(t|resp|req|entMeta)` is unused"
|
2020-06-23 17:43:24 +00:00
|
|
|
|
2023-08-22 14:46:03 +00:00
|
|
|
# Temp ignore everything in _ce(_test).go and _ent(_test).go. Many of these
|
2020-06-23 17:43:24 +00:00
|
|
|
# could use underscore to ignore the unused arguments, but the "always returns"
|
2023-08-22 14:46:03 +00:00
|
|
|
# issue will likely remain in CE, and will need to be excluded.
|
2020-06-23 17:43:24 +00:00
|
|
|
- linters: [unparam]
|
2023-08-22 14:46:03 +00:00
|
|
|
path: "(_ce.go|_ce_test.go|_ent.go|_ent_test.go)"
|
2020-05-14 21:02:52 +00:00
|
|
|
|
2020-03-12 01:18:03 +00:00
|
|
|
linters-settings:
|
2022-10-24 16:48:02 +00:00
|
|
|
govet:
|
|
|
|
check-shadowing: true
|
|
|
|
enable-all: true
|
|
|
|
disable:
|
|
|
|
- fieldalignment
|
|
|
|
- nilness
|
|
|
|
- shadow
|
|
|
|
- unusedwrite
|
2020-03-12 01:18:03 +00:00
|
|
|
gofmt:
|
2020-06-16 17:19:31 +00:00
|
|
|
simplify: true
|
2022-01-20 17:36:29 +00:00
|
|
|
forbidigo:
|
|
|
|
# Forbid the following identifiers (list of regexp).
|
|
|
|
forbid:
|
2022-11-10 16:26:01 +00:00
|
|
|
- '\bioutil\b(# Use io and os packages instead of ioutil)?'
|
2022-01-20 18:07:10 +00:00
|
|
|
- '\brequire\.New\b(# Use package-level functions with explicit TestingT)?'
|
|
|
|
- '\bassert\.New\b(# Use package-level functions with explicit TestingT)?'
|
2022-01-20 17:36:29 +00:00
|
|
|
# Exclude godoc examples from forbidigo checks.
|
|
|
|
# Default: true
|
|
|
|
exclude_godoc_examples: false
|
2022-09-02 16:56:40 +00:00
|
|
|
gomodguard:
|
|
|
|
blocked:
|
|
|
|
# List of blocked modules.
|
|
|
|
modules:
|
|
|
|
# Blocked module.
|
|
|
|
- github.com/hashicorp/net-rpc-msgpackrpc:
|
|
|
|
recommendations:
|
|
|
|
- github.com/hashicorp/consul-net-rpc/net-rpc-msgpackrpc
|
|
|
|
- github.com/hashicorp/go-msgpack:
|
|
|
|
recommendations:
|
|
|
|
- github.com/hashicorp/consul-net-rpc/go-msgpack
|
2023-06-05 20:08:39 +00:00
|
|
|
- github.com/golang/protobuf:
|
|
|
|
recommendations:
|
|
|
|
- google.golang.org/protobuf
|
2022-09-02 16:56:40 +00:00
|
|
|
|
|
|
|
depguard:
|
|
|
|
list-type: denylist
|
|
|
|
include-go-root: true
|
|
|
|
# A list of packages for the list type specified.
|
|
|
|
# Default: []
|
|
|
|
packages:
|
|
|
|
- net/rpc
|
|
|
|
# A list of packages for the list type specified.
|
|
|
|
# Specify an error message to output when a denied package is used.
|
|
|
|
# Default: []
|
|
|
|
packages-with-error-message:
|
2023-04-28 17:14:37 +00:00
|
|
|
- net/rpc: "only use forked copy in github.com/hashicorp/consul-net-rpc/net/rpc"
|
2023-06-05 20:08:39 +00:00
|
|
|
- github.com/golang/protobuf: "only use google.golang.org/protobuf"
|
2020-03-24 20:14:12 +00:00
|
|
|
|
|
|
|
run:
|
2020-06-03 20:50:35 +00:00
|
|
|
timeout: 10m
|
2022-05-05 17:42:52 +00:00
|
|
|
concurrency: 4
|
2023-06-05 20:08:39 +00:00
|
|
|
skip-dirs-use-default: false
|