all: enable use-any revive rule (#417)

Enable the `use-any` `revive` rule which requires replacing the empty
interface `interface{}` with `any`.
This commit is contained in:
Michael McLoughlin
2024-01-07 13:16:59 -08:00
committed by GitHub
parent d84f103398
commit 11e0a2138b
9 changed files with 9 additions and 11 deletions

View File

@@ -93,8 +93,6 @@ linters-settings:
disabled: true disabled: true
- name: unused-receiver - name: unused-receiver
disabled: true disabled: true
- name: use-any
disabled: true
issues: issues:
exclude-use-default: false exclude-use-default: false
exclude: exclude:

View File

@@ -166,7 +166,7 @@ func (c *Context) Comment(lines ...string) {
} }
// Commentf adds a formtted comment line. // Commentf adds a formtted comment line.
func (c *Context) Commentf(format string, a ...interface{}) { func (c *Context) Commentf(format string, a ...any) {
c.Comment(fmt.Sprintf(format, a...)) c.Comment(fmt.Sprintf(format, a...))
} }

View File

@@ -154,7 +154,7 @@ func Label(name string) { ctx.Label(name) }
func Comment(lines ...string) { ctx.Comment(lines...) } func Comment(lines ...string) { ctx.Comment(lines...) }
// Commentf adds a formtted comment line. // Commentf adds a formtted comment line.
func Commentf(format string, a ...interface{}) { ctx.Commentf(format, a...) } func Commentf(format string, a ...any) { ctx.Commentf(format, a...) }
// ConstData builds a static data section containing just the given constant. // ConstData builds a static data section containing just the given constant.
func ConstData(name string, v operand.Constant) operand.Mem { return ctx.ConstData(name, v) } func ConstData(name string, v operand.Constant) operand.Mem { return ctx.ConstData(name, v) }

View File

@@ -45,7 +45,7 @@ type Component interface {
// methods whilst also allowing method chaining to continue. // methods whilst also allowing method chaining to continue.
type componenterr string type componenterr string
func errorf(format string, args ...interface{}) Component { func errorf(format string, args ...any) Component {
return componenterr(fmt.Sprintf(format, args...)) return componenterr(fmt.Sprintf(format, args...))
} }

View File

@@ -71,7 +71,7 @@ func mainerr() (err error) {
} }
// Execute. // Execute.
data := map[string]interface{}{ data := map[string]any{
"Suite": suite, "Suite": suite,
} }

View File

@@ -86,7 +86,7 @@ func (c *Client) Issue(ctx context.Context, owner, name string, number int) (*Is
return issue, nil return issue, nil
} }
func (c *Client) request(req *http.Request, payload interface{}) (err error) { func (c *Client) request(req *http.Request, payload any) (err error) {
// Add common headers. // Add common headers.
if c.token != "" { if c.token != "" {
req.Header.Set("Authorization", "Bearer "+c.token) req.Header.Set("Authorization", "Bearer "+c.token)

View File

@@ -43,13 +43,13 @@ func (g *Generator) Dedent() {
} }
// Linef prints formatted output terminated with a new line. // Linef prints formatted output terminated with a new line.
func (g *Generator) Linef(format string, args ...interface{}) { func (g *Generator) Linef(format string, args ...any) {
g.Printf(format, args...) g.Printf(format, args...)
g.NL() g.NL()
} }
// Printf prints to the internal buffer. // Printf prints to the internal buffer.
func (g *Generator) Printf(format string, args ...interface{}) { func (g *Generator) Printf(format string, args ...any) {
if g.err != nil { if g.err != nil {
return return
} }

View File

@@ -182,6 +182,6 @@ func TestChecks(t *testing.T) {
} }
} }
func funcname(f interface{}) string { func funcname(f any) string {
return runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name() return runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name()
} }

View File

@@ -266,7 +266,7 @@ func AssertPredecessors(t *testing.T, f *ir.Function, expect map[string][]string
AssertEqual(t, "predecessors", OpcodePredecessorGraph(f), expect) AssertEqual(t, "predecessors", OpcodePredecessorGraph(f), expect)
} }
func AssertEqual(t *testing.T, what string, got, expect interface{}) { func AssertEqual(t *testing.T, what string, got, expect any) {
t.Helper() t.Helper()
t.Logf("%s=%#v\n", what, got) t.Logf("%s=%#v\n", what, got)
if reflect.DeepEqual(expect, got) { if reflect.DeepEqual(expect, got) {