Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of Sync .golangci.yml from ENT into release/1.15.x #17182

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 9 additions & 21 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

linters:
disable-all: true
enable:
Expand All @@ -20,29 +23,14 @@ issues:
# Temp Ignore SA9004: only the first constant in this group has an explicit type
# https://staticcheck.io/docs/checks#SA9004
- linters: [staticcheck]
text: 'SA9004:'

- linters: [staticcheck]
text: 'SA1019: "github.com/golang/protobuf/jsonpb" is deprecated: Use the "google.golang.org/protobuf/encoding/protojson" package instead.'

- linters: [staticcheck]
text: 'SA1019: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead.'

- linters: [staticcheck]
text: 'SA1019: ptypes.MarshalAny is deprecated'

- linters: [staticcheck]
text: 'SA1019: ptypes.UnmarshalAny is deprecated'

- linters: [staticcheck]
text: 'SA1019: "github.com/golang/protobuf/ptypes" is deprecated: Well-known types have specialized functionality directly injected into the generated packages for each message type. See the deprecation notice for each function for the suggested alternative.'
text: "SA9004:"

- linters: [staticcheck]
text: 'SA1019: "io/ioutil" has been deprecated since Go 1.16'

# An argument that always receives the same value is often not a problem.
- linters: [unparam]
text: 'always receives'
text: "always receives"

# Often functions will implement an interface that returns an error without
# needing to return an error. Sometimes the error return value is unnecessary
Expand All @@ -56,18 +44,18 @@ issues:
# self-documentation than a single underscore by itself. Underscore arguments
# should generally only be used when a function is implementing an interface.
- linters: [unparam]
text: '`_[^`]*` is unused'
text: "`_[^`]*` is unused"

# Temp ignore some common unused parameters so that unparam can be added
# incrementally.
- linters: [unparam]
text: '`(t|resp|req|entMeta)` is unused'
text: "`(t|resp|req|entMeta)` is unused"

# Temp ignore everything in _oss(_test).go and _ent(_test).go. Many of these
# could use underscore to ignore the unused arguments, but the "always returns"
# issue will likely remain in oss, and will need to be excluded.
- linters: [unparam]
path: '(_oss.go|_oss_test.go|_ent.go|_ent_test.go)'
path: "(_oss.go|_oss_test.go|_ent.go|_ent_test.go)"

linters-settings:
govet:
Expand Down Expand Up @@ -112,7 +100,7 @@ linters-settings:
# Specify an error message to output when a denied package is used.
# Default: []
packages-with-error-message:
- net/rpc: 'only use forked copy in github.com/hashicorp/consul-net-rpc/net/rpc'
- net/rpc: "only use forked copy in github.com/hashicorp/consul-net-rpc/net/rpc"

run:
timeout: 10m
Expand Down