diff options
| author | lhchavez <[email protected]> | 2020-12-01 19:11:41 -0800 |
|---|---|---|
| committer | lhchavez <[email protected]> | 2021-09-05 18:52:01 -0700 |
| commit | 5def02a589a2c1653f4bb515fdec290361a222be (patch) | |
| tree | b99d3a8204c27c902f711bc4f8f8b48baa8352bb /clone.go | |
| parent | 70e5e419cf0cab31553b106267a0296f3cd672d9 (diff) | |
The big Callback type adjustment of 2020
This change makes all callbacks that can fail return an `error`. This
makes things a lot more idiomatic.
Diffstat (limited to 'clone.go')
| -rw-r--r-- | clone.go | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -7,12 +7,11 @@ extern void _go_git_populate_clone_callbacks(git_clone_options *opts); */ import "C" import ( - "errors" "runtime" "unsafe" ) -type RemoteCreateCallback func(repo *Repository, name, url string) (*Remote, ErrorCode) +type RemoteCreateCallback func(repo *Repository, name, url string) (*Remote, error) type CloneOptions struct { *CheckoutOpts @@ -71,9 +70,10 @@ func remoteCreateCallback( panic("invalid remote create callback") } - remote, ret := data.options.RemoteCreateCallback(repo, name, url) - if ret < 0 { - *data.errorTarget = errors.New(ErrorCode(ret).String()) + remote, err := data.options.RemoteCreateCallback(repo, name, url) + + if err != nil { + *data.errorTarget = err return C.int(ErrorCodeUser) } if remote == nil { |
