From 2c7d3437cd6496900cc70f1ef2e63939e6df8bb3 Mon Sep 17 00:00:00 2001 From: Pramod Bindal Date: Wed, 25 Sep 2024 15:11:08 +0530 Subject: [PATCH] SRVKP-6439 : FixLint --- internal/fetch/fetch.go | 5 +++-- internal/provider/S3Provider.go | 16 ++++++---------- internal/provider/provider.go | 4 +++- internal/upload/upload.go | 5 +++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/fetch/fetch.go b/internal/fetch/fetch.go index c723405ed..87dadc639 100644 --- a/internal/fetch/fetch.go +++ b/internal/fetch/fetch.go @@ -3,12 +3,13 @@ package fetch import ( "context" "fmt" - "github.com/codeclysm/extract/v3" - "github.com/openshift-pipelines/tekton-caches/internal/provider" "net/url" "os" "strings" + "github.com/codeclysm/extract/v3" + "github.com/openshift-pipelines/tekton-caches/internal/provider" + "github.com/openshift-pipelines/tekton-caches/internal/provider/gcs" "github.com/openshift-pipelines/tekton-caches/internal/provider/oci" ) diff --git a/internal/provider/S3Provider.go b/internal/provider/S3Provider.go index 473d64eab..0dcdb6eff 100644 --- a/internal/provider/S3Provider.go +++ b/internal/provider/S3Provider.go @@ -3,14 +3,15 @@ package provider import ( "context" "fmt" - "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/config" - "github.com/aws/aws-sdk-go-v2/service/s3" "io" "log" "os" "path/filepath" "strings" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/config" + "github.com/aws/aws-sdk-go-v2/service/s3" ) const ( @@ -18,18 +19,13 @@ const ( AwsConfigFile = "AWS_CONFIG_FILE" ) -type S3Provider struct { -} - -func init() { - log.Println("Init S3 Provider") - Providers["s3"] = S3Provider{} -} +type S3Provider struct{} func (it S3Provider) Upload(ctx context.Context, target, filePath string) error { log.Printf("S3: Uploading to %s", target) return it.upload(ctx, target, filePath) } + func (it S3Provider) Fetch(ctx context.Context, source, filePath string) error { log.Printf("S3: Downloading %s", source) return it.download(ctx, source, filePath) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index afdc574e9..1b8c69c31 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -2,7 +2,9 @@ package provider import "context" -var Providers = map[string]Provider{} +var Providers = map[string]Provider{ + "s3": S3Provider{}, +} type Provider interface { Upload(ctx context.Context, target, filePath string) error diff --git a/internal/upload/upload.go b/internal/upload/upload.go index 4a3b5f0c2..317ada410 100644 --- a/internal/upload/upload.go +++ b/internal/upload/upload.go @@ -3,12 +3,13 @@ package upload import ( "context" "fmt" - "github.com/openshift-pipelines/tekton-caches/internal/provider" - "github.com/openshift-pipelines/tekton-caches/internal/utils" "net/url" "os" "strings" + "github.com/openshift-pipelines/tekton-caches/internal/provider" + "github.com/openshift-pipelines/tekton-caches/internal/utils" + "github.com/openshift-pipelines/tekton-caches/internal/provider/gcs" "github.com/openshift-pipelines/tekton-caches/internal/provider/oci" )