Skip to content

Instantly share code, notes, and snippets.

@warpfork
Created April 28, 2017 20:50
Show Gist options
  • Save warpfork/1cef292935d3c4873ac54d8e6897b0e9 to your computer and use it in GitHub Desktop.
Save warpfork/1cef292935d3c4873ac54d8e6897b0e9 to your computer and use it in GitHub Desktop.
wob wob wob
package main
// the command you are looking for is probably: git update-server-info
import (
"fmt"
"os"
"net/http"
)
func handler(resp http.ResponseWriter, req *http.Request) {
fmt.Printf("serving \"%s\"\n", req.URL.Path)
http.ServeFile(resp, req, req.URL.Path[1:])
}
func main() {
http.HandleFunc("/", handler)
var port string; if len(os.Args) > 1 { port = os.Args[1] } else { port = "80" }
fmt.Printf("Starting server on port "+port+"\n")
if err := http.ListenAndServe(":"+port, nil); err != nil {
fmt.Printf(err.Error()+"\n")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment