diff options
author | Kim Carlbäcker <kim.carlbacker@gmail.com> | 2017-10-09 16:53:21 +0300 |
---|---|---|
committer | Kim Carlbäcker <kim.carlbacker@gmail.com> | 2017-10-09 16:53:21 +0300 |
commit | 66ca560e32cf842e1135585cada9bc84c7e42e94 (patch) | |
tree | 0fc4692326c47f24db77a44e5bd4f62a0941e755 /STYLE.md | |
parent | 1a0a98bcaaa438ebb871cbcc6a2fb9e6234ddc7a (diff) |
Add style-guide about Stubs
Diffstat (limited to 'STYLE.md')
-rw-r--r-- | STYLE.md | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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 |