From eb574f9ad7e834f18d372b740d3f0e4bee8fcb8c Mon Sep 17 00:00:00 2001 From: Matthew Rich Date: Wed, 3 Apr 2024 15:58:29 -0700 Subject: [PATCH] fix linting errors --- internal/resource/container.go | 10 ++++++---- internal/resource/container_test.go | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/resource/container.go b/internal/resource/container.go index 8c97664..8106b03 100644 --- a/internal/resource/container.go +++ b/internal/resource/container.go @@ -100,10 +100,12 @@ func (c *Container) URI() string { func (c *Container) SetURI(uri string) error { resourceUri, e := url.Parse(uri) - if resourceUri.Scheme == c.Type() { - c.Name, e = filepath.Abs(filepath.Join(resourceUri.Hostname(), resourceUri.RequestURI())) - } else { - e = fmt.Errorf("%w: %s is not a %s", ErrInvalidResourceURI, uri, c.Type()) + if e == nil { + if resourceUri.Scheme == c.Type() { + c.Name, e = filepath.Abs(filepath.Join(resourceUri.Hostname(), resourceUri.RequestURI())) + } else { + e = fmt.Errorf("%w: %s is not a %s", ErrInvalidResourceURI, uri, c.Type()) + } } return e } diff --git a/internal/resource/container_test.go b/internal/resource/container_test.go index 001003e..a8c230b 100644 --- a/internal/resource/container_test.go +++ b/internal/resource/container_test.go @@ -34,7 +34,7 @@ func TestReadContainer(t *testing.T) { state: present ` m := &mocks.MockContainerClient{ - InjectContainerList: func(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) { + InjectContainerList: func(ctx context.Context, options container.ListOptions) ([]types.Container, error) { return []types.Container{ {ID: "123456789abc"}, {ID: "123456789def"},