Show HN: A Go web server with logging, tracing, and demo apps in a single file
github.com
github.com
Here are a few others:
- Twitter Clone in Haskell in a single file - https://news.ycombinator.com/item?id=21616661
- MPEG1 in a single C file - https://news.ycombinator.com/item?id=20643336
- SingleFile CMS - https://news.ycombinator.com/item?id=18336986
For example, there are ~130 lines of CSS in the Go file. Most editors have auto-formatting and suggestions for CSS for files ending in .css, which you won't get with this setup.
Also, with 885 lines of code, you have to wonder if reading the code is easier via scrolling / searching a single file or via tabs with multiple files.
It's not really an advantage, is it? Having everything mixed up into one giant file just makes the code much harder to make sense of.
It helped me immensely on a few projects where there was no dependency management to speak of, or wasn't allowed to use external dependency. Copy a single file and done.
What I'd suggest then is adding a section to the README.md that functions as a reading guide for the code; start here, read this, here's what each file is doing, here's where this sample app is, here's that one, etc.
Here's a good blog post with more info on stderr for those interested: https://www.jstorimer.com/blogs/workingwithcode/7766119-when...
> A twelve-factor app never concerns itself with routing or storage of its output stream. It should not attempt to write to or manage logfiles. Instead, each running process writes its event stream, unbuffered, to stdout.
Then, switching log provider is done globally, on the environment level (eg. installed on k8s)