golang / tour

[mirror] A Tour of Go
BSD 3-Clause "New" or "Revised" License
1.53k stars 521 forks source link

tour: use general verbs for proper printing #1568

Open Pulko opened 6 months ago

Pulko commented 6 months ago

Context: https://go.dev/tour/basics/14

This following piece of code does not use printing verbs, therefore it could be confusing for user to understand what does the v mean in function output.

func main() {
    v := 42 // change me!
    fmt.Printf("v is of type %T\n", v)
}

Suggestion:

func main() {
    v := 42 // change me!
    fmt.Printf("%v is of type %T\n", v, v)
}