Skip to content

Commit

Permalink
all: enable use-any revive rule (#417)
Browse files Browse the repository at this point in the history
Enable the `use-any` `revive` rule which requires replacing the empty
interface `interface{}` with `any`.
  • Loading branch information
mmcloughlin committed Jan 7, 2024
1 parent d84f103 commit 11e0a21
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ linters-settings:
disabled: true
- name: unused-receiver
disabled: true
- name: use-any
disabled: true
issues:
exclude-use-default: false
exclude:
Expand Down
2 changes: 1 addition & 1 deletion build/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (c *Context) Comment(lines ...string) {
}

// 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...))
}

Expand Down
2 changes: 1 addition & 1 deletion build/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func Label(name string) { ctx.Label(name) }
func Comment(lines ...string) { ctx.Comment(lines...) }

// 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.
func ConstData(name string, v operand.Constant) operand.Mem { return ctx.ConstData(name, v) }
Expand Down
2 changes: 1 addition & 1 deletion gotypes/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type Component interface {
// methods whilst also allowing method chaining to continue.
type componenterr string

func errorf(format string, args ...interface{}) Component {
func errorf(format string, args ...any) Component {
return componenterr(fmt.Sprintf(format, args...))
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/docgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func mainerr() (err error) {
}

// Execute.
data := map[string]interface{}{
data := map[string]any{
"Suite": suite,
}

Expand Down
2 changes: 1 addition & 1 deletion internal/github/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (c *Client) Issue(ctx context.Context, owner, name string, number int) (*Is
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.
if c.token != "" {
req.Header.Set("Authorization", "Bearer "+c.token)
Expand Down
4 changes: 2 additions & 2 deletions internal/prnt/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ func (g *Generator) Dedent() {
}

// 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.NL()
}

// 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 {
return
}
Expand Down
2 changes: 1 addition & 1 deletion operand/checks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
2 changes: 1 addition & 1 deletion pass/cfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func AssertPredecessors(t *testing.T, f *ir.Function, expect map[string][]string
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.Logf("%s=%#v\n", what, got)
if reflect.DeepEqual(expect, got) {
Expand Down

0 comments on commit 11e0a21

Please sign in to comment.