From 98cb22a73256a32e89f9e37bd082ac9adbefee85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Wed, 15 Jan 2025 11:08:18 -0600 Subject: [PATCH] Fix multiple errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- actor/sharedaction/resource.go | 6 +++--- util/clissh/ssh_test.go | 3 +-- util/ui/prompt.go | 2 +- util/ui/prompt_test.go | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/actor/sharedaction/resource.go b/actor/sharedaction/resource.go index 1a98ef16761..574d8c699cb 100644 --- a/actor/sharedaction/resource.go +++ b/actor/sharedaction/resource.go @@ -438,10 +438,10 @@ func (Actor) generateArchiveCFIgnoreMatcher(files []*zip.File) (*ignore.GitIgnor return nil, err } s := append(DefaultIgnoreLines, strings.Split(string(raw), "\n")...) - return ignore.CompileIgnoreLines(s...) + return ignore.CompileIgnoreLines(s...), nil } } - return ignore.CompileIgnoreLines(DefaultIgnoreLines...) + return ignore.CompileIgnoreLines(DefaultIgnoreLines...), nil } func (actor Actor) generateDirectoryCFIgnoreMatcher(sourceDir string) (*ignore.GitIgnore, error) { @@ -466,7 +466,7 @@ func (actor Actor) generateDirectoryCFIgnoreMatcher(sourceDir string) (*ignore.G if _, err := os.Stat(pathToCFIgnore); !os.IsNotExist(err) { return ignore.CompileIgnoreFileAndLines(pathToCFIgnore, additionalIgnoreLines...) } - return ignore.CompileIgnoreLines(additionalIgnoreLines...) + return ignore.CompileIgnoreLines(additionalIgnoreLines...), nil } func (Actor) findInResources(path string, filesToInclude []Resource) (Resource, bool) { diff --git a/util/clissh/ssh_test.go b/util/clissh/ssh_test.go index 9cef54c6bc5..738a7b13024 100644 --- a/util/clissh/ssh_test.go +++ b/util/clissh/ssh_test.go @@ -888,8 +888,7 @@ var _ = Describe("CLI SSH", Serial, FlakeAttempts(9), func() { fakeLocalListener.AcceptReturns(nil, errors.New("Not Accepting Connections")) echoServer = server.NewServer(logger.Session("echo"), "", echoHandler, 500*time.Millisecond) - err = echoServer.SetListener(echoListener) - Expect(err).NotTo(HaveOccurred()) + echoServer.SetListener(echoListener) go echoServer.Serve() forwardSpecs = []LocalPortForward{{ diff --git a/util/ui/prompt.go b/util/ui/prompt.go index ce55af040f2..dbf64aa047a 100644 --- a/util/ui/prompt.go +++ b/util/ui/prompt.go @@ -145,5 +145,5 @@ func contains(s []string, v string) bool { } func isInterrupt(err error) bool { - return errors.As(err, &interact.ErrNotBoolean) && errors.As(err, &interact.ErrNotANumber) + return !(errors.Is(err, interact.ErrNotBoolean) && errors.Is(err, interact.ErrNotANumber)) } diff --git a/util/ui/prompt_test.go b/util/ui/prompt_test.go index 1234e003aa7..f4762dae7fc 100644 --- a/util/ui/prompt_test.go +++ b/util/ui/prompt_test.go @@ -1,6 +1,7 @@ package ui_test import ( + "errors" "regexp" "code.cloudfoundry.org/cli/util/configv3" @@ -9,7 +10,6 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gbytes" - "github.com/vito/go-interact/interact" ) var _ = Describe("Prompts", func() { @@ -379,7 +379,7 @@ var _ = Describe("Prompts", func() { BeforeEach(func() { fakeResolver = new(uifakes.FakeResolver) - fakeResolver.ResolveReturns(interact.ErrKeyboardInterrupt) + fakeResolver.ResolveReturns(errors.New("keyboard interrupt")) fakeExiter = new(uifakes.FakeExiter) fakeInteractor = new(uifakes.FakeInteractor) fakeInteractor.NewInteractionReturns(fakeResolver)