From ed4662a9d8937d8e89a4141e3e38234dcfbf14f6 Mon Sep 17 00:00:00 2001 From: ktr Date: Fri, 26 Jul 2019 02:14:25 +0900 Subject: [PATCH] handle dropped error correctly (#183) --- ...lobal_and_local_config_are_not_found.golden.toml | 2 +- meta/meta.go | 2 +- mode/repl.go | 13 +++---------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/config/testdata/fixtures/create_a_default_global_config_if_both_of_global_and_local_config_are_not_found.golden.toml b/config/testdata/fixtures/create_a_default_global_config_if_both_of_global_and_local_config_are_not_found.golden.toml index 933ab1cc..6175b012 100644 --- a/config/testdata/fixtures/create_a_default_global_config_if_both_of_global_and_local_config_are_not_found.golden.toml +++ b/config/testdata/fixtures/create_a_default_global_config_if_both_of_global_and_local_config_are_not_found.golden.toml @@ -10,7 +10,7 @@ [meta] autoupdate = false - configversion = "0.8.0" + configversion = "0.8.1" updatelevel = "patch" [repl] diff --git a/meta/meta.go b/meta/meta.go index c92d35e9..c4705926 100644 --- a/meta/meta.go +++ b/meta/meta.go @@ -5,5 +5,5 @@ import version "github.com/hashicorp/go-version" const AppName = "evans" var ( - Version = version.Must(version.NewSemver("0.8.0")) + Version = version.Must(version.NewSemver("0.8.1")) ) diff --git a/mode/repl.go b/mode/repl.go index 123802c8..0ddd2e80 100644 --- a/mode/repl.go +++ b/mode/repl.go @@ -12,22 +12,19 @@ import ( "github.com/ktr0731/evans/prompt" "github.com/ktr0731/evans/repl" "github.com/ktr0731/evans/usecase" - "github.com/ktr0731/go-multierror" "github.com/pkg/errors" ) func RunAsREPLMode(cfg *config.Config, ui cui.UI, cache *cache.Cache) error { - var result error gRPCClient, err := newGRPCClient(cfg) if err != nil { - result = multierror.Append(result, err) - } else { - defer gRPCClient.Close(context.Background()) + return errors.Wrap(err, "failed to instantiate a new gRPC client") } + defer gRPCClient.Close(context.Background()) spec, err := newSpec(cfg, gRPCClient) if err != nil { - result = multierror.Append(result, err) + return errors.Wrap(err, "failed to instantiate a new spec") } usecase.Inject( @@ -37,10 +34,6 @@ func RunAsREPLMode(cfg *config.Config, ui cui.UI, cache *cache.Cache) error { json.NewPresenter(), ) - if result != nil { - return result - } - ctx, cancel := context.WithCancel(context.Background()) defer cancel()