Live data from Hacker News

Show HN: A simple Go web server with logging, tracing, health check

gist.github.com

31–40 of 97 posts

Re: Show HN: A simple Go web server with logging, tracing, health check

#33

Earlier quoted context omitted.

Hi chrisper, you are right! This is just a reminder for me on how to do those things when I start a new app in Go, instead of always google for them.

I like how you, as the owner of the repo and poster, agreed with me, yet I got -3 points...

FYI: You'll also get down voted for commenting on the down votes.

https://news.ycombinator.com/newsguidelines.html

Re: Show HN: A simple Go web server with logging, tracing, health check

#34
This reminds me of an ongoing discussion I was having with friends about Golang web frameworks -- one side of the argument is that you can achieve so much with the standard library that frameworks are "unnecessary", but folk like me want an ORM(ish) layer and some kind of back-office scaffolding.

https://beego.me and https://iris-go.com are nice, but we (all) have (as yet) to find a Django-like framework that comes with an extensible back-office.

So... Any pointers on the latter? I can do an Ask HN, but this seems like a good context to ask in.

(Edited to add: why the downvotes? Is this not a legitimate question?)

Re: Show HN: A simple Go web server with logging, tracing, health check

#35
post #31

This is likely better posted as a Show HN if it meets the guidelines: https://news.ycombinator.com/showhn.html

Hi grzm, you are probably right. Can I do this myself? editing the title with a "Show HN" prefix is sufficient?

Re: Show HN: A simple Go web server with logging, tracing, health check

#36
post #34

This reminds me of an ongoing discussion I was having with friends about Golang web frameworks -- one side of the argument is that you can achieve so much with the standard library that frameworks are "unnecessary", but folk like me want an ORM(ish) layer and some kind of back-office scaffolding. https://beego.me and https://iris-go.com are nice, but we (all) have (as yet) to find a Django-like framework that comes w…

Iris is a poorly maintained project that I would not recommend for production use.

See the drama unfold at https://www.reddit.com/r/golang/comments/57w79c/why_you_real... and https://www.reddit.com/r/golang/comments/57tmp1/why_you_shou...

Re: Show HN: A simple Go web server with logging, tracing, health check

#37
post #31

This is likely better posted as a Show HN if it meets the guidelines: https://news.ycombinator.com/showhn.html

Hi grzm, you are probably right. Can I do this myself? editing the title with a "Show HN" prefix is sufficient?

The ability to edit submissions is time-limited, IIRC. If you no longer see an edit link, you're likely outside of it. You can get in touch with the mods via the Contact link in the footer and they can update it for you. In my experience they're quite responsive.

Re: Show HN: A simple Go web server with logging, tracing, health check

#38
Here's a quick attempt at the same thing in Java (although note that the command line format is different):

https://gist.github.com/tomwhoiscontrary/b4888b86057c74a636c...

The main takeaway is that the JDK's built-in web server is poor:

* There is no way to configure timeouts

* Filters have to be added to each handler separately, by mucking with its filter list

* Filters have to extend an abstract class with two methods (one totally pointless), so you can't use lambdas for them

* Handlers use a simple string prefix match, so a request for "/healthzone" will hit the health handler

* The stop method always blocks for the specified timeout, and never returns early as the docs promise (IME)

Other minor irritations:

* There is no method to parse an InetSocketAddress from a string

* Java's support for handling clean process shutdown is not great; i think there's some sort of race between the shutdown hook and the logging system getting shut down, so you never see the "Server stopped" message

Re: Show HN: A simple Go web server with logging, tracing, health check

#39
post #34

This reminds me of an ongoing discussion I was having with friends about Golang web frameworks -- one side of the argument is that you can achieve so much with the standard library that frameworks are "unnecessary", but folk like me want an ORM(ish) layer and some kind of back-office scaffolding. https://beego.me and https://iris-go.com are nice, but we (all) have (as yet) to find a Django-like framework that comes w…

Rather than use a full-fledged framework, I would recommend combining orthogonal packages such as

- julienschmidt/httprouter [1] for routing,

- jmoiron/sqlx [2] for SQL access, and

- gorilla/websocket [3] for websockets

sqlx isn't an ORM; it's more a convenience wrapper around the standard library's database/sql package.

gorm is the nicest ORM I've found, but I think even the well-written ORM packages are unnatural to use because of restrictions in Go's type system.

(Sorry if this isn't the kind of answer you were hoping for.)

[1] https://github.com/julienschmidt/httprouter

[2] https://github.com/jmoiron/sqlx

[3] https://github.com/gorilla/websocket

Re: Show HN: A simple Go web server with logging, tracing, health check

#40
post #34

This reminds me of an ongoing discussion I was having with friends about Golang web frameworks -- one side of the argument is that you can achieve so much with the standard library that frameworks are "unnecessary", but folk like me want an ORM(ish) layer and some kind of back-office scaffolding. https://beego.me and https://iris-go.com are nice, but we (all) have (as yet) to find a Django-like framework that comes w…

I regularly go down this road with go. My conclusion is that it's never going to suit that use case. I'm not even sure it's not technically doable (i think introspection and interface{} can go quite far), but it's just culturally opposed to this kind of project.

People like go for its minimalist approach. Not in the sense that you don't have a lot of code to write, but more in the sense that you are in control of everything that happens, and that you can read an understand every part of your codebase.

ORMs , code gen, magic wrappers, etc is something that people in that community just hate.

Post reply on HN