Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Be careful about printing error as string in GoLang

In GoLang, we can format and produce string using fmt.Printf(), just like C, GoLang also supports format verbs like %s, %d which can be placeholder for different types of values. But please pay attention when printing error as string so that you will not fall into some trap.Let's first take an example code snippet and see what trap we are talking about.package mainimport "fmt"type A stringfunc (a A) Error() string { return fmt.Sprintf("%s is an error", a)}func main() { a := A("hello") fmt.Printf("error is %s", a)}What do you expect the output is? Do you expect "error is hello is an error"? Unf...

21,177 2       STACKOVERFLOW GOLANG FMT


  Statistics on StackExchange

StackExchange is the most popular and professional IT Q&A site, Under StackExchange, there is StackOverflow and other sub sites. Many of us may wonder how this mega site is maintained and what its performance is. A performance page has been released by StackExchange recently.Below is some statistic about this mega site.560 million page views per month, i.e around 1.9 million PVs per day.For such as big site, it has only 9 web servers and 4 SQL servers(while two of them are in backup mode)185 requests per second, 559 million SQL queries per day with peak rate at 10,700 queries/secTwo redis ...

4,876 0       STATISTIC STACKOVERFLOW