From 95911100823b5c809225d664de74ad2d64e91972 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Thu, 22 Dec 2022 23:19:31 +0100 Subject: cache: fix some bugs after refactor --- commands/execenv/env.go | 24 +++++++++++------------- commands/execenv/env_testing.go | 5 +---- 2 files changed, 12 insertions(+), 17 deletions(-) (limited to 'commands/execenv') diff --git a/commands/execenv/env.go b/commands/execenv/env.go index 0813ab7e..4c6ce204 100644 --- a/commands/execenv/env.go +++ b/commands/execenv/env.go @@ -136,19 +136,17 @@ func LoadBackend(env *Env) func(*cobra.Command, []string) error { if events != nil { env.Err.Println("Building cache... ") - } - - for event := range events { - if event.Err != nil { - env.Err.Printf("Cache building error [%s]: %v\n", event.Typename, event.Err) - continue - } - - switch event.Event { - case cache.BuildEventStarted: - env.Err.Printf("[%s] started\n", event.Typename) - case cache.BuildEventFinished: - env.Err.Printf("[%s] done\n", event.Typename) + for event := range events { + if event.Err != nil { + env.Err.Printf("Cache building error [%s]: %v\n", event.Typename, event.Err) + continue + } + switch event.Event { + case cache.BuildEventStarted: + env.Err.Printf("[%s] started\n", event.Typename) + case cache.BuildEventFinished: + env.Err.Printf("[%s] done\n", event.Typename) + } } } diff --git a/commands/execenv/env_testing.go b/commands/execenv/env_testing.go index ddba735f..5761b410 100644 --- a/commands/execenv/env_testing.go +++ b/commands/execenv/env_testing.go @@ -34,11 +34,8 @@ func NewTestEnv(t *testing.T) *Env { buf := new(bytes.Buffer) - backend, events, err := cache.NewRepoCache(repo) + backend, err := cache.NewRepoCacheNoEvents(repo) require.NoError(t, err) - for event := range events { - require.NoError(t, event.Err) - } t.Cleanup(func() { backend.Close() -- cgit