I have a small web server written in Go. I wanted to serve Git repositories from this server. It turned out to be surprisingly easy since git-http-backend and the cgi package do all the hard work.
First, define a function for handling Git's HTTP requests:
Second, connect that function to the mux you're already using:
Now I can clone from and push to my little Go server.