summaryrefslogtreecommitdiffstats
path: root/CONTRIBUTING.md
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-18 22:04:33 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-01-18 22:06:17 +1100
commitb5a8ecf786a7d7593060684029ba97abd7ad093a (patch)
tree4d80882e9f7027e3d1faedbeee7d28e5f4f5fd9e /CONTRIBUTING.md
parent3e80a9e886007e11cc774b74a32959625e102750 (diff)
update contributing docs
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r--CONTRIBUTING.md38
1 files changed, 32 insertions, 6 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d5553c637..786bc65f6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -6,7 +6,7 @@ When contributing to this repository, please first discuss the change you wish
to make via issue, email, or any other method with the owners of this repository
before making a change.
-## So all code changes happen through Pull Requests
+## All code changes happen through Pull Requests
Pull requests are the best way to propose changes to the codebase. We actively
welcome your pull requests:
@@ -14,10 +14,10 @@ welcome your pull requests:
1. Fork the repo and create your branch from `master`.
2. If you've added code that should be tested, add tests.
3. If you've added code that need documentation, update the documentation.
-4. Make sure your code follows the [effective go](https://golang.org/doc/effective_go.html) guidelines as much as possible.
-5. Be sure to test your modifications.
-6. Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
-7. Issue that pull request!
+4. Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
+5. Issue that pull request!
+
+If you've never written Go in your life, then join the club! Lazygit was the maintainer's first Go program, and most contributors have never used Go before. Go is widely considered an easy-to-learn language, so if you're looking for an open source project to gain dev experience, you've come to the right place.
## Code of conduct
@@ -36,9 +36,31 @@ covers the project. Feel free to contact the maintainers if that's a concern.
We use GitHub issues to track public bugs. Report a bug by [opening a new
issue](https://github.com/jesseduffield/lazygit/issues/new); it's that easy!
+## Go
+
+This project is written in Go. Go is an opinionated language with strict idioms, but some of those idioms are a little extreme. Some things we do differently:
+
+1. There is no shame in using `self` as a receiver name in a struct method. In fact we encourage it
+2. There is no shame in prefixing an interface with 'I' instead of suffixing with 'er' when there are several methods on the interface.
+3. If a struct implements an interface, we make it explicit with something like:
+
+```go
+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.
+
+## 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!).
+
+## Testing
+
+Lazygit has two kinds of tests: unit tests and integration tests. Unit tests go in files that end in `_test.go`, and are written in Go. Lazygit has its own integration test system where you can build a sandbox repo with a shell script, record yourself doing something, and commit the resulting repo snapshot. It's pretty damn cool! To learn more see [here](https://github.com/jesseduffield/lazygit/blob/master/docs/Integration_Tests.md)
+
## Updating Gocui
-Sometimes you will need to make a change in the gocui fork (https://github.com/jesseduffield/gocui). Gocui is the package responsible for rending windows and handling user input. Here's the typical process to follow:
+Sometimes you will need to make a change in the gocui fork (https://github.com/jesseduffield/gocui). Gocui is the package responsible for rendering windows and handling user input. Here's the typical process to follow:
1. Make the changes in gocui inside the vendor directory so it's easy to test against lazygit
2. Copy the changes over to the actual gocui repo (clone it if you haven't already, and use the `awesome` branch, not `master`)
@@ -50,3 +72,7 @@ Sometimes you will need to make a change in the gocui fork (https://github.com/j
```
5. Raise a PR in lazygit with those changes
+
+## Improvements
+
+If you can think of any way to improve these docs let us know.