本文主要是介绍possible formatting directive,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
比如:
fmt.Println("Hello, playground %d",i)
那么会出现warning:Println call has possible formatting directive %d Go vet exited.
fmt.Println doesn't do formatting things like %d. Instead, it uses the default format of its arguments, and adds spaces between them.
fmt.Println("Hello, playground",i) // Hello, playground 5
If you want printf style formatting, use fmt.Printf.
fmt.Printf("Hello, playground %d\n",i)
And you don't need to be particular about the type. %v will generally figure it out.
fmt.Printf("Hello, playground %v\n",i)
这篇关于possible formatting directive的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!