▲ | lelanthran 2 days ago | |||||||||||||
I'm not seeing the point here, TBH. What use-case does this author's single-binary satisfy? 1. You just want to serve static files from your blog? Install a webserver and knock yourself out in your editor, creating html and css (and maybe js) files. 2. You want to serve static files, with some dynamic crap stuffed inside here and there like the examples given in the article? Install the mod_php or equivalent for your webserver, and go mad with the editor. 3. You want fully generated content? Install one of the many backend frameworks in any language you want to use, and then go mad in your IDE. What use-case does "one binary I wrote in Go" satisfy that isn't covered above? From everything I gleaned from the article, the PHP solution is even easier, while still technically being "one single binary". EDIT: as an example of over-engineering, here is the authors code for a specific use-case:
And here is the equivalent in PHP:
| ||||||||||||||
▲ | bob1029 2 days ago | parent | next [-] | |||||||||||||
> What use-case does "one binary I wrote in Go" satisfy that isn't covered above? In .NET land, one of the top reasons to go all-in with a single exe web server would be performance. Kestrel can be unbelievably fast if you remove all of the layers of indirection like IPC and hosted SQL. I've got dynamic HTML pages that render in <100uS and that includes managing session state and other queries into SQLite. Concerns like accidentally showing up on the front page of HN or even petty DDOS attempts can be often be ignored when you are able to serve content this quickly. The other major reason I like it is having everything in one type system and debugger experience. I can set a breakpoint anywhere and inspect everything. | ||||||||||||||
▲ | malwrar 2 days ago | parent | prev | next [-] | |||||||||||||
Easier to deploy? No need for packaging everything or installing runtime stuff, just copy one file on your server and run it. | ||||||||||||||
| ||||||||||||||
▲ | 0x6c6f6c 10 hours ago | parent | prev | next [-] | |||||||||||||
The author also says they want to be able to understand all of the components of the system. Software that needs upgrades that may not be backwards compatible is an issue. I imagine many web servers can fall under either of these concerns, including Apache and Nginx. I'm not a fan of Go myself, but I can see how a simple Go HTTP server fits the bill. | ||||||||||||||
▲ | jbreckmckye 2 days ago | parent | prev | next [-] | |||||||||||||
But Go is so simple! (Points to a myriad of Go functions that do in eight or nine lines what other languages do in two) | ||||||||||||||
| ||||||||||||||
▲ | Veen 2 days ago | parent | prev | next [-] | |||||||||||||
It solves the author's use case, which the article explains at some length. | ||||||||||||||
▲ | dlachausse 2 days ago | parent | prev | next [-] | |||||||||||||
I think a lot of it is just for the author's own fun, enjoyment, and amusement. Also, golang is probably their favorite hammer. It's not efficient for me to smoke a brisket myself or make furniture by woodworking, but I enjoy it. Not everything has to have any more purpose than that. | ||||||||||||||
| ||||||||||||||
▲ | hkon 2 days ago | parent | prev [-] | |||||||||||||
sigh |