Go does build as a static binary. However, if all you're doing in production is serving static files, nginx is a better solution. Python and SimpleHTTPServer isn't for production anyway. Best of luck in your deployment. Maybe you'll be able to find a use case for Go in your future endeavors. If not, that's cool too. Use the best tool to accomplish your goals. :)
On Thu, Sep 29, 2016, 9:16 PM Darren Hoo <darren....@gmail.com> wrote: > Sure, for my development environment, I can do all this.. > > But on a server with only Go installed, in order to use go get, I have to > setup GOPATH, I have to installed git. And I have to cross the great > firewall of china. > > Oh my god, thank you guys. forget what I said. Go is not built for doing > such a simple thing. > > To myself: Man!, just stick with Python.... > > > On Friday, September 30, 2016 at 11:43:29 AM UTC+8, Diego Medina wrote: >> >> 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. > -- 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.