Commit 12123f05 by Arve Knudsen Committed by GitHub

Style guide: Document avoidance of globals in Go code (#29803)

* Chore: Document avoidance of globals in Go code

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
parent cedaf41a
......@@ -39,3 +39,9 @@ Tests must use the standard library, `testing`. For assertions, prefer using [te
The majority of our tests uses [GoConvey](http://goconvey.co/) but that's something we want to avoid going forward.
In the `sqlstore` package we do database operations in tests and while some might say that's not suited for unit tests. We think they are fast enough and provide a lot of value.
## Globals
As a general rule of thumb, avoid using global variables, since they make the code difficult to maintain and reason
about, and to write tests for. The Grafana codebase currently does use a lot of global variables, especially when
it comes to configuration, but that is a problem we're trying to solve.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment