But static binary is way bigger than 10loc snippet, if I compile it to binary which is 6.7 megabytes in size on my laptop, and then scp to my server, it takes 10 minutes to upload meanwhile I can not do anything on the server because my network is saturated during uploading.
The case with SimpleHTTPServer is certainly not a production usage. Actually We built a server using net/http which handle 30 billion requests per day without any problems, and we use http.ServeContent for serivng static files. net/http is really good for us and we don't use nginx all. We just use LVS plus six backend servers. With regard to "production ready", someone suggests not using Go's tls: https://github.com/golang/go/issues/17053#issuecomment-246834654. I think It's kind of FUD. Not only do we use Go's https, we used it happyily and believe Go team can respond quickly to any possible security problems. On Friday, September 30, 2016 at 12:27:29 PM UTC+8, Harley Laue wrote: > > 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 <darre...@gmail.com <javascript:>> > 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...@googlegroups.com <javascript:>. >> 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.