sql.Open() doesn't open anythingWe all know the basic drill of connecting a db in Go: func main(){ //... dsn := flag.String("dsn", "web:password@/demoProject", "MySQL data source name") flag.Parse() db, err := openDB(*dsn) if err3 min read·areeshzafar.hashnode.devApr 11
(Golang)You've Been Calling It a Handler Wrong All AlongWhen routing in go, we attach a normal function to a router and call it a handler, for example : package main func home(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello from Snippe2 min read·areeshzafar.hashnode.devApr 8
How Go's Server Multiplexer Actually Works Learn how Go's ServeMux routes HTTP requests, the difference between fixed and subtree paths, and why longer URLs always win.3 min read·areeshzafar.hashnode.devApr 7