github.com/powerman/golang-tools@v0.1.11-0.20220410185822-5ad214d8d803/go/analysis/passes/stringintconv/testdata/src/a/a.go.golden (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 5 // This file contains tests for the stringintconv checker. 6 7 package a 8 9 type A string 10 11 type B = string 12 13 type C int 14 15 type D = uintptr 16 17 func StringTest() { 18 var ( 19 i int 20 j rune 21 k byte 22 l C 23 m D 24 n = []int{0, 1, 2} 25 o struct{ x int } 26 ) 27 const p = 0 28 _ = string(rune(i)) // want `^conversion from int to string yields a string of one rune, not a string of digits \(did you mean fmt\.Sprint\(x\)\?\)$` 29 _ = string(j) 30 _ = string(k) 31 _ = string(rune(p)) // want `^conversion from untyped int to string yields a string of one rune, not a string of digits \(did you mean fmt\.Sprint\(x\)\?\)$` 32 _ = A(rune(l)) // want `^conversion from C \(int\) to A \(string\) yields a string of one rune, not a string of digits \(did you mean fmt\.Sprint\(x\)\?\)$` 33 _ = B(rune(m)) // want `^conversion from uintptr to B \(string\) yields a string of one rune, not a string of digits \(did you mean fmt\.Sprint\(x\)\?\)$` 34 _ = string(rune(n[1])) // want `^conversion from int to string yields a string of one rune, not a string of digits \(did you mean fmt\.Sprint\(x\)\?\)$` 35 _ = string(rune(o.x)) // want `^conversion from int to string yields a string of one rune, not a string of digits \(did you mean fmt\.Sprint\(x\)\?\)$` 36 }