colega / unexpected-go

Unexpected Golang behaviors
MIT License
47 stars 7 forks source link

Write about positional fmt arguments #20

Open colega opened 1 year ago

colega commented 1 year ago

See example:

package main

import (
    "fmt"
)

func main() {
    fmt.Printf("%v, %[1]v, %v, %[1]v, %v\n", 1, 2, 3, 4, 5)
    fmt.Printf("%v, %[1]v, %v, %[3]v, %v\n", 1, 2, 3, 4, 5)
    fmt.Printf("%v, %[5]v, %v, %[3]v, %v\n", 1, 2, 3, 4, 5)
    fmt.Printf("%v, %[1]v, %v, %[2]v, %v\n", 1, 2, 3, 4, 5)
}