Skip to content

Commit bd5ceb5

Browse files
authored
Enable unused-receiver linter (revive) (#7448)
Signed-off-by: Anders Eknert <[email protected]>
1 parent 7049966 commit bd5ceb5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+95
-93
lines changed

.golangci.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,10 @@ linters-settings:
186186
rules:
187187
# this mainly complains about us using min/max for variable names,
188188
# which seems like an unlikely source of actual issues
189-
- name: redefines-builtin-id
190-
disabled: true
189+
- name: redefines-builtin-id
190+
disabled: true
191+
- name: unused-receiver
192+
disabled: false
191193

192194
linters:
193195
disable-all: true

cmd/bench.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func benchMain(args []string, params benchmarkCommandParams, w io.Writer, r benc
230230
type goBenchRunner struct {
231231
}
232232

233-
func (r *goBenchRunner) run(ctx context.Context, ectx *evalContext, params benchmarkCommandParams, f func(context.Context, ...rego.EvalOption) error) (testing.BenchmarkResult, error) {
233+
func (*goBenchRunner) run(ctx context.Context, ectx *evalContext, params benchmarkCommandParams, f func(context.Context, ...rego.EvalOption) error) (testing.BenchmarkResult, error) {
234234

235235
var hist, m metrics.Metrics
236236
if params.metrics {

cmd/eval.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ func newrepeatedStringFlag(val []string) repeatedStringFlag {
788788
}
789789
}
790790

791-
func (f *repeatedStringFlag) Type() string {
791+
func (*repeatedStringFlag) Type() string {
792792
return stringType
793793
}
794794

@@ -818,7 +818,7 @@ func newIntFlag(val int) intFlag {
818818
}
819819
}
820820

821-
func (f *intFlag) Type() string {
821+
func (*intFlag) Type() string {
822822
return "int"
823823
}
824824

cmd/flags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func newcapabilitiesFlag() *capabilitiesFlag {
207207
}
208208
}
209209

210-
func (f *capabilitiesFlag) Type() string {
210+
func (*capabilitiesFlag) Type() string {
211211
return stringType
212212
}
213213

@@ -236,7 +236,7 @@ type stringptrFlag struct {
236236
isSet bool
237237
}
238238

239-
func (f *stringptrFlag) Type() string {
239+
func (*stringptrFlag) Type() string {
240240
return stringType
241241
}
242242

cmd/internal/env/env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var (
2222

2323
const globalPrefix = "opa"
2424

25-
func (cf cmdFlagsImpl) CheckEnvironmentVariables(command *cobra.Command) error {
25+
func (cmdFlagsImpl) CheckEnvironmentVariables(command *cobra.Command) error {
2626
var errs []string
2727
v := viper.New()
2828
v.AutomaticEnv()

internal/logging/logging.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func spaces(num int) string {
5050
return strings.Repeat(" ", num)
5151
}
5252

53-
func (p *prettyFormatter) Format(e *logrus.Entry) ([]byte, error) {
53+
func (*prettyFormatter) Format(e *logrus.Entry) ([]byte, error) {
5454
b := new(bytes.Buffer)
5555

5656
level := strings.ToUpper(e.Level.String())

internal/prometheus/prometheus.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (p *Provider) InstrumentHandler(handler http.Handler, label string) http.Ha
9494
}
9595

9696
// Info returns attributes that describe the metric provider.
97-
func (p *Provider) Info() metrics.Info {
97+
func (*Provider) Info() metrics.Info {
9898
return metrics.Info{
9999
Name: "prometheus",
100100
}

internal/providers/aws/signing_v4a.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ func buildAuthorizationHeader(credentialStr, signedHeadersStr, signingSignature
280280
return parts.String()
281281
}
282282

283-
func (s *httpSigner) buildCanonicalHeaders(host string, rule v4Internal.Rule, header http.Header, length int64) (signed http.Header, signedHeaders, canonicalHeadersStr string) {
283+
func (*httpSigner) buildCanonicalHeaders(host string, rule v4Internal.Rule, header http.Header, length int64) (signed http.Header, signedHeaders, canonicalHeadersStr string) {
284284
signed = make(http.Header)
285285

286286
const hostHeader = "host"

internal/wasm/module/module.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func (x ExportDescriptorType) String() string {
288288
}
289289

290290
// Kind returns the function import type kind.
291-
func (i FunctionImport) Kind() ImportDescriptorType {
291+
func (FunctionImport) Kind() ImportDescriptorType {
292292
return FunctionImportType
293293
}
294294

@@ -297,7 +297,7 @@ func (i FunctionImport) String() string {
297297
}
298298

299299
// Kind returns the memory import type kind.
300-
func (i MemoryImport) Kind() ImportDescriptorType {
300+
func (MemoryImport) Kind() ImportDescriptorType {
301301
return MemoryImportType
302302
}
303303

@@ -306,7 +306,7 @@ func (i MemoryImport) String() string {
306306
}
307307

308308
// Kind returns the table import type kind.
309-
func (i TableImport) Kind() ImportDescriptorType {
309+
func (TableImport) Kind() ImportDescriptorType {
310310
return TableImportType
311311
}
312312

@@ -315,7 +315,7 @@ func (i TableImport) String() string {
315315
}
316316

317317
// Kind returns the global import type kind.
318-
func (i GlobalImport) Kind() ImportDescriptorType {
318+
func (GlobalImport) Kind() ImportDescriptorType {
319319
return GlobalImportType
320320
}
321321

internal/wasm/sdk/opa/loader/http/loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ func (l *Loader) get(ctx context.Context, tag string) (*bundle.Bundle, error) {
258258

259259
// close closes the HTTP response gracefully, first draining it, to
260260
// avoid resource leaks.
261-
func (l *Loader) close(resp *http.Response) {
261+
func (*Loader) close(resp *http.Response) {
262262
_, _ = io.Copy(io.Discard, resp.Body) // Ignore errors.
263263
_ = resp.Body.Close()
264264
}

0 commit comments

Comments
 (0)