Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Carlbäcker <kim.carlbacker@gmail.com>2017-10-09 16:53:21 +0300
committerKim Carlbäcker <kim.carlbacker@gmail.com>2017-10-09 16:53:21 +0300
commit66ca560e32cf842e1135585cada9bc84c7e42e94 (patch)
tree0fc4692326c47f24db77a44e5bd4f62a0941e755
parent1a0a98bcaaa438ebb871cbcc6a2fb9e6234ddc7a (diff)
Add style-guide about Stubs
-rw-r--r--STYLE.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/STYLE.md b/STYLE.md
index 300dfa0ab..3a6ae2bad 100644
--- a/STYLE.md
+++ b/STYLE.md
@@ -88,3 +88,23 @@ func TestTime(t *testing.T) {
[Cheney blog post]: https://dave.cheney.net/2013/06/09/writing-table-driven-tests-in-go
[Golang wiki]: https://github.com/golang/go/wiki/TableDrivenTests
+
+## Stubs
+
+Stubs should be put in the file they're expected to end up in and not in `server.go`.
+So for example `BlobService::GetBlob` should end up in `internal/service/blob/get_blob.go`.
+This is to guard against merge conflicts, and to make it easier to find.
+
+To minimize diffs (and things to review in MRs) we implement the stubs as if it were
+being used, even though it isn't, and should end up something like this:
+```
+func (s *server) GetBlob(in *pb.GetBlobRequest, stream pb.BlobService_GetBlobServer) error {
+ return helper.Unimplemented
+}
+```
+instead of:
+```
+func (server) GetBlob(_ *pb.GetBlobRequest, _ pb.BlobService_GetBlobServer) error {
+ return helper.Unimplemented
+}
+``` \ No newline at end of file