github.com/Johnny2210/revive@v1.0.8-0.20210625134200-febf37ccd0f5/testdata/string-of-int.go (about)

     1  // Copyright 2020 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  package fixtures
     5  
     6  type A string
     7  type B = string
     8  type C int
     9  type D = uintptr
    10  
    11  func StringTest() {
    12  	var (
    13  		i int
    14  		j rune
    15  		k byte
    16  		l C
    17  		m D
    18  		n = []int{0, 1, 2}
    19  		o struct{ x int }
    20  	)
    21  	const p = 0
    22  	_ = string(i) // MATCH /dubious convertion of an integer into a string, use strconv.Itoa/
    23  	_ = string(j)
    24  	_ = string(k)
    25  	_ = string(p)    // MATCH /dubious convertion of an integer into a string, use strconv.Itoa/
    26  	_ = A(l)         // MATCH /dubious convertion of an integer into a string, use strconv.Itoa/
    27  	_ = B(m)         // MATCH /dubious convertion of an integer into a string, use strconv.Itoa/
    28  	_ = string(n[1]) // MATCH /dubious convertion of an integer into a string, use strconv.Itoa/
    29  	_ = string(o.x)  // MATCH /dubious convertion of an integer into a string, use strconv.Itoa/
    30  }