| -- 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" |
| |
| func _(x uint64) { |
| println(fmt.Sprintf("%d", x)) // want `conversion from uint64 to string yields...` |
| } |
| |
| -- Convert single rune to string (preserves 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" |
| |
| func _(x uint64) { |
| println(fmt.Sprintf("%c", x)) // want `conversion from uint64 to string yields...` |
| } |