Skip to content

Commit

Permalink
fix lint error by renaming to Opts
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Thakur <[email protected]>
  • Loading branch information
Harsh Thakur committed Sep 6, 2023
1 parent 56d5696 commit b94ff16
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/buildkit/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type Config struct {
ImageState llb.State
}

type BuildkitOpts struct {
type Opts struct {
Addr string
CACertPath string
CertPath string
Expand Down
4 changes: 2 additions & 2 deletions pkg/buildkit/buildkit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions pkg/buildkit/drivers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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 != "" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/patch/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions pkg/patch/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b94ff16

Please sign in to comment.