Hi, If you don't want to have to copy/paste that snippet of code on a new laptop/OS install, I have been using:
$ go get github.com/rif/spark $ spark static_site/ for the last couple of years, works great, it's simple. https://github.com/rif/spark Regards, Diego On Thursday, September 29, 2016 at 11:10:29 PM UTC-4, Dave Cheney wrote: > > > Since Go is battery included and http is part of its core library, > > We said batteries, not the kitchen sink. > > But seriously, the standard library gives you the components to build > these tools yourself. If the Go distro included a http server that just > served static files, while this would be perfect for your use case, others > who wanted a server that forwarded to FastCGI would be incensed that Go > shipped with such a limited tool, and furthermore we refused to improve it. > It's better to give you the tools to write exactly the program you want, > then you can share it with the world via go get. > > On Friday, 30 September 2016 12:14:26 UTC+10, Darren Hoo wrote: >> >> One thing that I really like about python is this one command line to >> serve static files: >> >> python -m SimpleHTTPServer >> >> >> This is very convenient. >> >> >> Now I just want to use Go to do the same thing, I have to copy the >> snippet from >> >> https://github.com/golang/go/wiki/HttpStaticFiles and go run it. >> >> >> Since Go is battery included and http is part of its core library, why >> not >> >> just build it into the Go toolchain, So every time I want to serve static >> files, >> >> I can fire up go like this: >> >> >> go tool http /usr/share/doc >> >> >> go tool http --addr=:8888 /usr/share/doc >> >> >> >> >> >> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.