From 807424b52bbede51990d57ed6e388f9ccc283770 Mon Sep 17 00:00:00 2001 From: Tim Heckman Date: Sun, 16 Jul 2017 19:34:44 -0700 Subject: [PATCH] cmd/go-contrib-init: exit with an error if package install fails During the first run of `go-contrib-init` it tries to install the golang.org/x/review/git-codereview package using `go get`. If this command were to fail, we would check for the error and log that the command failed to succeed. However, when failure occurred we would only log the error and not interrupt the flow of the program. This would cause the program to continue with the assumption that git-codereview had been installed correctly. This change enhances the `go-contrib-init` command to exit with a bad status code, after logging the failure, if installing git-codereview fails. Fixes golang/go#21040 Change-Id: Ie01d78557d54285001db61faafbb409888b2893c Reviewed-on: https://go-review.googlesource.com/49151 Reviewed-by: Brad Fitzpatrick --- cmd/go-contrib-init/contrib.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/go-contrib-init/contrib.go b/cmd/go-contrib-init/contrib.go index 64c79178..7c657463 100644 --- a/cmd/go-contrib-init/contrib.go +++ b/cmd/go-contrib-init/contrib.go @@ -263,7 +263,7 @@ func checkGitCodeReview() { } err := exec.Command("go", "get", "golang.org/x/review/git-codereview").Run() if err != nil { - log.Printf("Error running go get golang.org/x/review/git-codereview: %v", cmdErr(err)) + log.Fatalf("Error running go get golang.org/x/review/git-codereview: %v", cmdErr(err)) } log.Printf("Installed git-codereview (ran `go get golang.org/x/review/git-codereview`)") }