mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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>
This commit is contained in:
parent
cedaf41a36
commit
12123f0540
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user