From b94ff1679ddb0616399b43addb74e37e5a2efe80 Mon Sep 17 00:00:00 2001 From: Harsh Thakur Date: Wed, 6 Sep 2023 17:51:24 +0530 Subject: [PATCH] fix lint error by renaming to Opts Signed-off-by: Harsh Thakur --- pkg/buildkit/buildkit.go | 2 +- pkg/buildkit/buildkit_test.go | 4 ++-- pkg/buildkit/drivers.go | 4 ++-- pkg/patch/cmd.go | 2 +- pkg/patch/patch.go | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/buildkit/buildkit.go b/pkg/buildkit/buildkit.go index e649c172..f9d0cfdf 100644 --- a/pkg/buildkit/buildkit.go +++ b/pkg/buildkit/buildkit.go @@ -40,7 +40,7 @@ type Config struct { ImageState llb.State } -type BuildkitOpts struct { +type Opts struct { Addr string CACertPath string CertPath string diff --git a/pkg/buildkit/buildkit_test.go b/pkg/buildkit/buildkit_test.go index dd713136..bd5f91da 100644 --- a/pkg/buildkit/buildkit_test.go +++ b/pkg/buildkit/buildkit_test.go @@ -184,7 +184,7 @@ func TestNewClient(t *testing.T) { t.Parallel() addr := newMockBuildkitAPI(t) ctxT, cancel := context.WithTimeout(ctx, time.Second) - bkOpts := BuildkitOpts{ + bkOpts := Opts{ Addr: "unix://" + addr, } client, err := NewClient(ctxT, bkOpts) @@ -203,7 +203,7 @@ func TestNewClient(t *testing.T) { ctxT, cancel := context.WithTimeout(ctx, time.Second) defer cancel() - bkOpts := BuildkitOpts{ + bkOpts := Opts{ Addr: "unix://" + addr, } client, err := NewClient(ctxT, bkOpts) diff --git a/pkg/buildkit/drivers.go b/pkg/buildkit/drivers.go index 6cff2bc6..73f38b0e 100644 --- a/pkg/buildkit/drivers.go +++ b/pkg/buildkit/drivers.go @@ -27,7 +27,7 @@ var ( // NewClient returns a new buildkit client with the given addr. // If addr is empty it will first try to connect to docker's buildkit instance and then fallback to DefaultAddr. -func NewClient(ctx context.Context, bkOpts BuildkitOpts) (*client.Client, error) { +func NewClient(ctx context.Context, bkOpts Opts) (*client.Client, error) { if bkOpts.Addr == "" { return autoClient(ctx) } @@ -39,7 +39,7 @@ func NewClient(ctx context.Context, bkOpts BuildkitOpts) (*client.Client, error) return client, nil } -func getCredentialOptions(bkOpts BuildkitOpts) []client.ClientOpt { +func getCredentialOptions(bkOpts Opts) []client.ClientOpt { opts := []client.ClientOpt{} // addr := bkOpts.Addr if bkOpts.CACertPath != "" { diff --git a/pkg/patch/cmd.go b/pkg/patch/cmd.go index 77363f26..7b0fcc4d 100644 --- a/pkg/patch/cmd.go +++ b/pkg/patch/cmd.go @@ -42,7 +42,7 @@ func NewPatchCmd() *cobra.Command { Short: "Patch container images with upgrade packages specified by a vulnerability report", Example: "copa patch -i images/python:3.7-alpine -r trivy.json -t 3.7-alpine-patched", RunE: func(cmd *cobra.Command, args []string) error { - bkopts := buildkit.BuildkitOpts{ + bkopts := buildkit.Opts{ Addr: ua.buildkitAddr, CACertPath: ua.buildkitCACertPath, CertPath: ua.buildkitClientCertPath, diff --git a/pkg/patch/patch.go b/pkg/patch/patch.go index 369c6bf2..07b7081b 100644 --- a/pkg/patch/patch.go +++ b/pkg/patch/patch.go @@ -29,7 +29,7 @@ const ( ) // Patch command applies package updates to an OCI image given a vulnerability report. -func Patch(ctx context.Context, timeout time.Duration, image, reportFile, patchedTag, workingFolder, format, output string, ignoreError bool, bkOpts buildkit.BuildkitOpts) error { +func Patch(ctx context.Context, timeout time.Duration, image, reportFile, patchedTag, workingFolder, format, output string, ignoreError bool, bkOpts buildkit.Opts) error { timeoutCtx, cancel := context.WithTimeout(ctx, timeout) defer cancel() @@ -60,7 +60,7 @@ func removeIfNotDebug(workingFolder string) { } } -func patchWithContext(ctx context.Context, image, reportFile, patchedTag, workingFolder, format, output string, ignoreError bool, bkOpts buildkit.BuildkitOpts) error { +func patchWithContext(ctx context.Context, image, reportFile, patchedTag, workingFolder, format, output string, ignoreError bool, bkOpts buildkit.Opts) error { imageName, err := ref.ParseNamed(image) if err != nil { return err