Hacker News new | ask | show | jobs
by cronos 3752 days ago
The code examples are quite non-idiomatic and have lots of issues, to be honest.

- constant strings (defined as vars) as return values instead of the standard error type

- not formatted

- synthetic request's response body not closed - a memory leak

- log.Fatal (which results in os.Exit(1) immediately killing the program) for all the non-critical errors

- timestamp as a string instead of time.Time in the struct

- not re-using http.DefaultClient

- 3rd party package with a custom DSL instead of a simple time.Ticker

Sorry for the pedantry, but if such code examples live on the internet, newcomers to Go will learn from it (if not blindly copy-paste) and it will spread even further indirectly giving bad reputation to the language.

P.S. i do like this idea of continuous integration testing in production, will probably start using it at our company.

1 comments

Why not post a comment on the post itself with constructive criticism?
It seems like the author was in this thread.

But you're right, re-posted my comment in a less aggressive form on the post itself.