Go

Go

By DeepSource

Recursive call to the String receiver GO-W1025

Bug risk

Calling the fmt family of functions in the String method receiver with the receiver as the argument will lead to infinite recursion.

Bad practice

package main

import (
    "fmt"
)

type myInt int

func (a myInt) String() string {
    fmt.Println(a) // will call the String receiver recursively.
    return ...
}