gitee.com/wgliang/goreporter@v0.0.0-20180902115603-df1b20f7c5d0/linters/simplecode/testdata/format-int.go (about)

     1  package pkg
     2  
     3  import "strconv"
     4  
     5  func ifn() int     { return 0 }
     6  func ifn32() int32 { return 0 }
     7  func ifn64() int64 { return 0 }
     8  
     9  func fn() {
    10  	var i int
    11  	var i32 int32
    12  	var i64 int64
    13  	const c = 0
    14  	const c32 int32 = 0
    15  	const c64 int64 = 0
    16  
    17  	strconv.FormatInt(int64(i), 10) // MATCH /strconv.Itoa instead of strconv.FormatInt/
    18  	strconv.FormatInt(int64(i), 2)
    19  	strconv.FormatInt(int64(i32), 10) // MATCH /strconv.Itoa instead of strconv.FormatInt/
    20  	strconv.FormatInt(int64(i64), 10)
    21  	strconv.FormatInt(i64, 10)
    22  	strconv.FormatInt(123, 10)        // MATCH /strconv.Itoa instead of strconv.FormatInt/
    23  	strconv.FormatInt(int64(123), 10) // MATCH /strconv.Itoa instead of strconv.FormatInt/
    24  	strconv.FormatInt(int64(999999999999999999), 10)
    25  	strconv.FormatInt(int64(int64(123)), 10)
    26  	strconv.FormatInt(c, 10)          // MATCH /strconv.Itoa instead of strconv.FormatInt/
    27  	strconv.FormatInt(int64(c), 10)   // MATCH /strconv.Itoa instead of strconv.FormatInt/
    28  	strconv.FormatInt(int64(c32), 10) // MATCH /strconv.Itoa instead of strconv.FormatInt/
    29  	strconv.FormatInt(c64, 10)
    30  	strconv.FormatInt(int64(ifn()), 10)   // MATCH /strconv.Itoa instead of strconv.FormatInt/
    31  	strconv.FormatInt(int64(ifn32()), 10) // MATCH /strconv.Itoa instead of strconv.FormatInt/
    32  	strconv.FormatInt(int64(ifn64()), 10)
    33  }