summaryrefslogtreecommitdiffstats
path: root/CONTRIBUTING.md
diff options
context:
space:
mode:
authorMoritz Haase <Moritz.Haase@bmw.de>2022-03-22 14:25:56 +0100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-23 08:18:06 +1100
commitac687a5a2a52aa4aa60d03bd8bc42f611a2ac931 (patch)
tree28e13fe70d5a3c8d954e909a06e629ebed6cb2b8 /CONTRIBUTING.md
parenta34bdf1a046c90c22a1c0b653241b8107e89c7f9 (diff)
docs: Add section about code formatting to contributors guide
Explain that gofumpt is used instead of gofmt and how to configure VSCode to use it.
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r--CONTRIBUTING.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a1a4a3ea7..0b9a6ee5d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -50,6 +50,21 @@ var _ MyInterface = &MyStruct{}
This makes the intent clearer and means that if we fail to satisfy the interface we'll get an error in the file that needs fixing.
+### Code Formatting
+
+To check code formatting [gofumpt](https://pkg.go.dev/mvdan.cc/gofumpt#section-readme) (which is a bit stricter than [gofmt](https://pkg.go.dev/cmd/gofmt)) is used.
+VSCode will format the code correctly if you tell the Go extension to use `gofumpt` via your [`settings.json`](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson)
+by setting [`formatting.gofumpt`](https://github.com/golang/tools/blob/master/gopls/doc/settings.md#gofumpt-bool) to `true`:
+
+```jsonc
+// .vscode/settings.json
+{
+ "gopls": {
+ "formatting.gofumpt": true
+ }
+}
+```
+
## Internationalisation
Boy that's a hard word to spell. Anyway, lazygit is translated into several languages within the pkg/i18n package. If you need to render text to the user, you should add a new field to the TranslationSet struct in `pkg/i18n/english.go` and add the actual content within the `EnglishTranslationSet()` method in the same file. Although it is appreciated if you translate the text into other languages, it's not expected of you (google translate will likely do a bad job anyway!).