Update: the licence plate application has since been refused. The reason given is that they don’t allow offensive messages. All I can think of is that they misread it as being “GOP HER,” which doesn’t mean anything but they may have assumed it was some code, new slang or something. I live in Quebec and…
Tag: golang
How to use FileServer with Gorilla’s Subrouter
I’ve just spent much more time than I ever wanted to get this right, so here’s how I did it for future reference. I have a function that returns an http.Handler, kind of like this: func Handler(prefix string) http.Handler { r := mux.NewRouter().PathPrefix(prefix).Subrouter() r.HandleFunc(“/foo/”, fooHandler).Methods(“GET”) r.HandleFunc(“/bar/”, barHandler).Methods(“GET”) return r } The prefix could be something…
Returns in Go and C#
Whenever someone posts anything related to the Go programming language on Hacker News, it never takes long before someone complains about error handling. I find it interesting because it is exactly one of things I like the most about Go. I don’t want to specifically talk about error handling though. I want to talk about…
Clashing method names in Go interfaces
I wrote about how the Go and C# compilers implement interfaces and mentioned how C# deals with clashing method names but I didn’t talk about how Go does it, so here it is. Two interfaces with the same method name that need to behave differently is very likely a sign of bad API design and…
Interfaces in Go and C#
I make no secret of the fact that I love Go. I think it’s a wonderfully designed language and it gave me nothing but pleasure in the years I’ve been working with it full time. Now however I am working on a project that requires the use of C#, which prompted me to realize something….
Github’s Swift Style guide
Github has published a Swift Style Guide: When you have to meet certain criteria to continue execution, try to exit early. So, instead of this: if n.isNumber { // Use n here } else { return } use this: guard n.isNumber else { return } // Use n here Feels very Go-like.