From 66ca560e32cf842e1135585cada9bc84c7e42e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Carlb=C3=A4cker?= Date: Mon, 9 Oct 2017 13:53:21 +0000 Subject: Add style-guide about Stubs --- STYLE.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'STYLE.md') 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 -- cgit v1.2.3