summaryrefslogtreecommitdiff
path: root/cmd/ponzu/options.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-11-02 21:30:59 -0700
committerSteve Manuel <nilslice@gmail.com>2016-11-02 21:30:59 -0700
commit8eb95906bcbee2ce1e29c633f5b7460bfba2934d (patch)
treebba92b63113c570399d66eae8a96c6afc4113429 /cmd/ponzu/options.go
parent689bd8b70c1b4fe53dc94ca1884755f45a0c25c9 (diff)
catching nil err before attempting to call Error
Diffstat (limited to 'cmd/ponzu/options.go')
-rw-r--r--cmd/ponzu/options.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/cmd/ponzu/options.go b/cmd/ponzu/options.go
index 3cd4910..062975b 100644
--- a/cmd/ponzu/options.go
+++ b/cmd/ponzu/options.go
@@ -168,10 +168,12 @@ func newProjectInDir(path string) error {
var answer string
_, err := fmt.Scanf("%s\n", &answer)
- if err.Error() == "unexpected newline" {
- answer = ""
- } else if err != nil {
- return err
+ if err != nil {
+ if err.Error() == "unexpected newline" {
+ answer = ""
+ } else {
+ return err
+ }
}
answer = strings.ToLower(answer)
@@ -179,7 +181,6 @@ func newProjectInDir(path string) error {
switch answer {
case "n", "no", "\r\n", "\n", "":
fmt.Println("")
- fmt.Println(answer)
case "y", "yes":
err := os.RemoveAll(path)