From dbe032c347b1a1308a4b880e7c5a06d8dfb4d507 Mon Sep 17 00:00:00 2001 From: lhchavez Date: Sun, 5 Sep 2021 13:59:36 -0700 Subject: Make all non-user-creatable structures non-comparable (#802) This change makes all non-user-creatable structures non-comparable. This makes it easier to add changes later that don't introduce breaking changes from the go compatibility guarantees perspective. This, of course, implies that this change _is_ a breaking change, but since these structures are not intended to be created by users (or de-referenced), it should be okay. --- submodule.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'submodule.go') diff --git a/submodule.go b/submodule.go index 2042125..673cf5f 100644 --- a/submodule.go +++ b/submodule.go @@ -21,6 +21,7 @@ type SubmoduleUpdateOptions struct { // Submodule type Submodule struct { + doNotCompare ptr *C.git_submodule r *Repository } @@ -82,6 +83,7 @@ const ( ) type SubmoduleCollection struct { + doNotCompare repo *Repository } @@ -117,7 +119,7 @@ type submoduleCallbackData struct { //export submoduleCallback func submoduleCallback(csub unsafe.Pointer, name *C.char, handle unsafe.Pointer) C.int { - sub := &Submodule{(*C.git_submodule)(csub), nil} + sub := &Submodule{ptr: (*C.git_submodule)(csub)} data, ok := pointerHandles.Get(handle).(submoduleCallbackData) if !ok { -- cgit v1.2.3