From cf6522c7fe093244a14334ced1c90c9791231a3e Mon Sep 17 00:00:00 2001 From: Suhaib Mujahid Date: Sat, 9 May 2020 23:32:17 -0400 Subject: refactor: Rename methods with Get prefix It is not Go idiomatic to put Get into the getter's name. https: //golang.org/doc/effective_go.html#Getters Co-Authored-By: lhchavez --- diff.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'diff.go') diff --git a/diff.go b/diff.go index 0939435..edc1e20 100644 --- a/diff.go +++ b/diff.go @@ -144,7 +144,7 @@ func (diff *Diff) NumDeltas() (int, error) { return ret, nil } -func (diff *Diff) GetDelta(index int) (DiffDelta, error) { +func (diff *Diff) Delta(index int) (DiffDelta, error) { if diff.ptr == nil { return DiffDelta{}, ErrInvalid } @@ -154,6 +154,11 @@ func (diff *Diff) GetDelta(index int) (DiffDelta, error) { return ret, nil } +// deprecated: You should use `Diff.Delta()` instead. +func (diff *Diff) GetDelta(index int) (DiffDelta, error) { + return diff.Delta(index) +} + func newDiffFromC(ptr *C.git_diff, repo *Repository) *Diff { if ptr == nil { return nil -- cgit v1.2.3