| -- Format number as decimal (changes behavior) -- |
| // This code relies on pre-go1.28 string(integer) conversion rules; |
| // the build tag downgrades the file to go1.21 (the oldest version |
| // to which a build tag can downgrade). |
| //go:build go1.21 |
| |
| package fix |
| |
| import "fmt" |
| |
| type mystring string |
| |
| func _(x int16) mystring { |
| return mystring(fmt.Sprintf("%d", x)) // want `conversion from int16 to mystring \(string\)...` |
| } |
| |
| -- Convert a single rune to a string -- |
| // This code relies on pre-go1.28 string(integer) conversion rules; |
| // the build tag downgrades the file to go1.21 (the oldest version |
| // to which a build tag can downgrade). |
| //go:build go1.21 |
| |
| package fix |
| |
| type mystring string |
| |
| func _(x int16) mystring { |
| return mystring(rune(x)) // want `conversion from int16 to mystring \(string\)...` |
| } |