From 00e81bd0b1e12d8fbf5cd5ced2a9363cd5cde94b Mon Sep 17 00:00:00 2001 From: Calvin Behling Date: Sat, 7 May 2016 17:07:26 -0500 Subject: [PATCH] Fix panic in the basic example code The `remote.upInfo` for origin isn't set before it used in PullDefault. Calling `Connect` on the remote before calling `PullDefault` fixes the problem. --- README.md | 4 ++++ examples/basic/main.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 57f7f6427..9bbca1d37 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,10 @@ if err != nil { panic(err) } +if err := r.Remotes[git.DefaultRemoteName].Connect(); err != nil { + panic(err) +} + if err := r.PullDefault(); err != nil { panic(err) } diff --git a/examples/basic/main.go b/examples/basic/main.go index f5a1c8a8a..4a96b446a 100644 --- a/examples/basic/main.go +++ b/examples/basic/main.go @@ -15,6 +15,10 @@ func main() { panic(err) } + if err := r.Remotes[git.DefaultRemoteName].Connect(); err != nil { + panic(err) + } + if err := r.PullDefault(); err != nil { panic(err) }